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

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

- Page: https://pluginprobe.com/plugins/acymailing/10.11.1/code/back/Helpers/ToolbarHelper.php
- Raw: https://pluginprobe.com/plugins/acymailing/10.11.1/raw/back/Helpers/ToolbarHelper.php
- Modified: 2025-03-03T13:35: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/10.11.1/code/back/Helpers/ToolbarHelper.php#L10-L20`.

```php
<?php

namespace AcyMailing\Helpers;

use AcyMailing\Core\AcymObject;

class ToolbarHelper extends AcymObject
{
    private string $leftPart = '';
    private string $rightPart = '';
    private array $moreOptionsPart = [];

    public function addButton(string $textContent, array $attributes, string $icon = '', bool $isPrimary = false): void
    {
        $data = [
            'icon' => $icon,
            'content' => acym_translation($textContent),
            'attributes' => $attributes,
            'isPrimary' => $isPrimary,
        ];

        ob_start();
        include acym_getPartial('toolbar', 'button_main');
        $this->rightPart .= ob_get_clean();
    }

    public function addOtherContent(string $content, string $side = 'right'): void
    {
        if (in_array($side, ['left', 'right'])) {
            $this->{$side.'Part'} .= $content;
        }
    }

    public function addSearchBar(string $search, string $name, string $placeholder = 'ACYM_SEARCH', bool $showClearBtn = true): void
    {
        $this->leftPart .= acym_filterSearch($search, $name, $placeholder, $showClearBtn, 'acym__toolbar__search-field margin-bottom-0');
    }

    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,
                acym_escape($data['tag']),
                [
                    'class' => $class,
                ],
                'value',
                'name'
            )
        );
    }

    public function addOptionSelect(string $title, string $select): void
    {
        $this->moreOptionsPart[] = '<div class="cell grid-x shrink acym__toolbar__filters__select"><label class="cell">'.$title.'</label>'.$select.'</div>';
    }

    public function displayToolbar(array $data): void
    {
        $data['leftPart'] = $this->leftPart;
        $data['rightPart'] = $this->rightPart;
        $data['moreOptionsPart'] = $this->moreOptionsPart;
        include acym_getPartial('toolbar', 'toolbar');
    }
}

```
