PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / trunk
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress vtrunk
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 10.3.0 10.4.0 All 60 releases
acymailing / back / Types / DtextType.php

DtextType.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress trunk, at back/Types/DtextType.php

57 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Types;
4
5 use AcyMailing\Helpers\TabHelper;
6 use AcyMailing\Core\AcymObject;
7
8 class DtextType extends AcymObject
9 {
10 public function display(array $options = []): void
11 {
12 $options['withButton'] = $options['withButton'] ?? true;
13 $options['context'] = $options['context'] ?? '';
14
15 if ($options['withButton']) {
16 $this->displayButton($options);
17 }
18
19 $data = [
20 'plugins' => $this->getIntegrations(),
21 'options' => $options,
22 'tabHelper' => new TabHelper(),
23 ];
24
25 include acym_getPartial('dtext', 'picker');
26 }
27
28 public function displayButton(array $options = []): void
29 {
30 $data = [
31 'class' => $options['class'] ?? '',
32 'editor' => $options['editor'] ?? '',
33 'selection' => $options['selection'] ?? '',
34 'icon' => $options['icon'] ?? 'acymicon-plus-circle',
35 'text' => $options['text'] ?? '',
36 ];
37
38 include acym_getPartial('dtext', 'button');
39 }
40
41 private function getIntegrations(): array
42 {
43 $integrations = acym_trigger('dynamicText', [null]);
44 usort(
45 $integrations,
46 function ($a, $b) {
47 $nameA = isset($a->name) && is_string($a->name) ? strtolower($a->name) : '';
48 $nameB = isset($b->name) && is_string($b->name) ? strtolower($b->name) : '';
49
50 return $nameA > $nameB ? 1 : -1;
51 }
52 );
53
54 return empty($integrations) ? [] : $integrations;
55 }
56 }
57