# acymailing/11.0.4/back/Helpers/ToolbarHelper.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version 11.0.4. 109 lines.

- Page: https://pluginprobe.com/plugins/acymailing/11.0.4/code/back/Helpers/ToolbarHelper.php
- Raw: https://pluginprobe.com/plugins/acymailing/11.0.4/raw/back/Helpers/ToolbarHelper.php
- Modified: 2026-08-03T10:18:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/11.0.4/code/back/Helpers/ToolbarHelper.php#L10-L20`.

```php
<?php

namespace AcyMailing\Helpers;

use AcyMailing\Core\AcymObject;

class ToolbarHelper extends AcymObject
{
    private array $searchBarInformation = [];
    private array $actionButtons = [];
    private array $filteringOptions = [];

    public function addSearchBar(string $search, string $name, string $placeholder = 'ACYM_SEARCH', bool $showClearBtn = true): void
    {
        $this->searchBarInformation = [
            'search' => $search,
            'name' => $name,
            'placeholder' => $placeholder,
            'showClearBtn' => $showClearBtn,
        ];
    }

    public function addButton(string $textContent, array $attributes, string $icon = '', bool $isPrimary = false): void
    {
        $this->actionButtons[] = [
            'type' => 'button',
            'icon' => $icon,
            'content' => acym_translation($textContent),
            'attributes' => $attributes,
            'isPrimary' => $isPrimary,
        ];
    }

    public function addModalButton(array $options): void
    {
        $options['type'] = 'modal';
        $this->actionButtons[] = $options;
    }

    public function addFilterByTag(array &$data, string $name, string $class): void
    {
        $allTags = new \stdClass();
        $allTags->name = acym_translation('ACYM_ALL_TAGS');
        $allTags->value = '';
        array_unshift($data['allTags'], $allTags);
        $this->addOptionSelect(
            acym_translation('ACYM_TAG'),
            acym_select(
                $data['allTags'],
                $name,
                $data['tag'],
                [
                    'class' => $class,
                ],
                'value',
                'name'
            )
        );
    }

    public function addOptionSelect(string $title, string $select): void
    {
        $this->filteringOptions[] = [
            'title' => $title,
            'select' => $select,
        ];
    }

    public function displayToolbar(array $data): void
    {
        $data['toolbarHelper'] = $this;
        $data['searchBarInformation'] = $this->searchBarInformation;
        $data['actionButtons'] = $this->actionButtons;
        $data['filteringOptions'] = $this->filteringOptions;
        include acym_getPartial('toolbar', 'toolbar');
    }

    public function displaySearchBar(): void
    {
        acym_filterSearch(
            $this->searchBarInformation['search'],
            $this->searchBarInformation['name'],
            $this->searchBarInformation['placeholder'],
            $this->searchBarInformation['showClearBtn'],
            'acym__toolbar__search-field margin-bottom-0'
        );
    }

    public function displayActionButtons(): void
    {
        foreach ($this->actionButtons as $data) {
            if ($data['type'] === 'button') {
                include acym_getPartial('toolbar', 'button_main');
            } else {
                acym_modal(
                    $data['button'],
                    $data['modalContent'] ?? '',
                    $data['id'] ?? null,
                    $data['attributesModal'] ?? [],
                    $data['attributesButton'] ?? [],
                    $data['isButton'] ?? true,
                    $data['isLarge'] ?? true,
                    $data['classesModal'] ?? '',
                );
            }
        }
    }
}

```
