forked from symphonists/backend_assets
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.driver.php
34 lines (27 loc) · 986 Bytes
/
extension.driver.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
<?php
Class extension_backend_assets extends Extension{
public function getSubscribedDelegates(){
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => 'appendAssets'
),
);
}
/*-------------------------------------------------------------------------
Delegates:
-------------------------------------------------------------------------*/
public function appendAssets() {
// Styles
$styles = '/workspace/backend-assets/custom.css';
if(file_exists(DOCROOT . $styles)) {
Administration::instance()->Page->addStylesheetToHead(URL . $styles . '?v=' . date('YmdHi', filemtime(DOCROOT . $styles)), 'screen', 1000, false);
}
// Scripts
$scripts = '/workspace/backend-assets/custom.js';
if(file_exists(DOCROOT . $scripts)) {
Administration::instance()->Page->addScriptToHead(URL . $scripts . '?v=' . date('YmdHi', filemtime(DOCROOT . $scripts)), 1001);
}
}
}