PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.0.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.0.1
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Helpers / ToolbarHelper.php

ToolbarHelper.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.0.1, at back/Helpers/ToolbarHelper.php

77 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Helpers;
4
5 use AcyMailing\Core\AcymObject;
6
7 class ToolbarHelper extends AcymObject
8 {
9 private string $leftPart = '';
10 private string $rightPart = '';
11 private array $moreOptionsPart = [];
12
13 public function addButton($textContent, $attributes, $icon = '', $isPrimary = false)
14 {
15 $data = [];
16 $data['icon'] = $icon;
17 $data['content'] = acym_translation($textContent);
18 $data['attributes'] = $attributes;
19 $data['isPrimary'] = $isPrimary;
20
21 ob_start();
22 include acym_getPartial('toolbar', 'button_main');
23 $this->rightPart .= ob_get_clean();
24 }
25
26 public function addOtherContent($content, $side = 'right')
27 {
28 if (in_array($side, ['left', 'right'])) {
29 $this->{$side.'Part'} .= $content;
30 }
31 }
32
33 public function addSearchBar($search, $name, $placeholder = 'ACYM_SEARCH', $showClearBtn = true)
34 {
35 $this->leftPart .= acym_filterSearch($search, $name, $placeholder, $showClearBtn, 'acym__toolbar__search-field margin-bottom-0');
36 }
37
38 public function addFilterByTag(&$data, $name, $class)
39 {
40 $allTags = new \stdClass();
41 $allTags->name = acym_translation('ACYM_ALL_TAGS');
42 $allTags->value = '';
43 array_unshift($data['allTags'], $allTags);
44 $this->addOptionSelect(
45 acym_translation('ACYM_TAG'),
46 acym_select(
47 $data['allTags'],
48 $name,
49 acym_escape($data['tag']),
50 [
51 'class' => $class,
52 ],
53 'value',
54 'name'
55 )
56 );
57 }
58
59 public function addOption($content)
60 {
61 $this->moreOptionsPart[] = $content;
62 }
63
64 public function addOptionSelect($title, $select)
65 {
66 $this->moreOptionsPart[] = '<div class="cell grid-x shrink acym__toolbar__filters__select"><label class="cell">'.$title.'</label>'.$select.'</div>';
67 }
68
69 public function displayToolbar($data)
70 {
71 $data['leftPart'] = $this->leftPart;
72 $data['rightPart'] = $this->rightPart;
73 $data['moreOptionsPart'] = $this->moreOptionsPart;
74 include acym_getPartial('toolbar', 'toolbar');
75 }
76 }
77