-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathLoadHelperTrait.php
More file actions
46 lines (37 loc) · 1.06 KB
/
Copy pathLoadHelperTrait.php
File metadata and controls
46 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Queue\Controller\Admin;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Templating\View\Helper\IconHelper;
use Templating\View\Helper\IconSnippetHelper;
use Templating\View\Helper\TemplatingHelper;
trait LoadHelperTrait {
/**
* @return void
*/
protected function loadHelpers(): void {
$helpers = [];
// Time helper: prefer Tools, fallback to core
if (Plugin::isLoaded('Tools')) {
$helpers[] = 'Tools.Time';
$helpers[] = 'Tools.Text';
$helpers[] = 'Tools.Format';
} else {
$helpers[] = 'Time';
$helpers[] = 'Text';
}
// Configure helper: prefer Shim, fallback to Queue's own
$helpers[] = Plugin::isLoaded('Shim') ? 'Shim.Configure' : 'Queue.Configure';
if (Configure::read('Icon.sets') && class_exists(IconHelper::class)) {
$helpers[] = 'Templating.Icon';
}
if (class_exists(IconSnippetHelper::class)) {
$helpers[] = 'Templating.IconSnippet';
}
if (class_exists(TemplatingHelper::class)) {
$helpers[] = 'Templating.Templating';
}
$this->viewBuilder()->addHelpers($helpers);
}
}