-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtelephasic.php
45 lines (38 loc) · 1.28 KB
/
telephasic.php
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
<?php
namespace Grav\Theme;
use Grav\Common\Theme;
use RocketTheme\Toolbox\Event\Event;
use Grav\Common\Page\Interfaces\PageInterface;
/**
* Telephasic Theme
*
* Class Telephasic
*
* @category Extensions
* @package Grav\Theme
* @author Pedro Moreno <https://github.com/pmoreno-rodriguez>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://github.com/pmoreno-rodriguez/grav-theme-telephasic
*/
class Telephasic extends Theme
{
public static function getSubscribedEvents()
{
return [
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
];
}
/**
* Register custom CSS or JavaScript assets
**/
public function onTwigSiteVariables()
{
$themeConfig = $this->config->get('themes.telephasic');
if (isset($themeConfig['custom_css']) && $themeConfig['custom_css'] && file_exists(__DIR__ . '/assets/css/custom.css')) {
$this->grav['assets']->addCss('theme://assets/css/custom.css', ['priority' => 10]);
}
if (isset($themeConfig['custom_js']) && $themeConfig['custom_js'] && file_exists(__DIR__ . '/assets/js/custom.js')) {
$this->grav['assets']->addJs('theme://assets/js/custom.js', ['group' => 'bottom', 'priority' => 15]);
}
}
}