-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIconsFilter.module
38 lines (33 loc) · 1.03 KB
/
IconsFilter.module
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
<?php
class IconsFilter extends WireData implements Module {
/**
* Module information
*/
public static function getModuleInfo() {
return array(
'title' => 'Icons Filter',
'version' => 2,
'summary' => 'Enables filtering of icons by name in the InputfieldIcon view.',
'author' => 'Daniel Zilli',
'autoload' => "template=admin",
);
}
/**
* Ready
*/
public function ready() {
$this->addHookAfter('InputfieldIcon::render', $this, 'addExtras');
}
/**
* Add script and stylesheet
*/
public function addExtras($event) {
$info = $this->getModuleInfo();
$version = $info['version'];
$out = $event->return;
$modulePath = $this->config->urls->siteModules . "IconsFilter/";
$out .= "<script src='{$modulePath}IconsFilter.js?v=$version'></script>";
$out .= "<link rel='stylesheet' href='{$modulePath}IconsFilter.css?v=$version'>";
$event->return = $out;
}
}