summaryrefslogtreecommitdiffstats
path: root/inc/render.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-10 17:36:05 +0200
committerSimon Rettberg2017-05-10 17:36:05 +0200
commit47657731433248410e681640b2a53c0783651134 (patch)
tree3ee31a268b89ec154be6169c0139067f066495c0 /inc/render.inc.php
parent[locationinfo] install: Match table column type to referenced table (diff)
downloadslx-admin-47657731433248410e681640b2a53c0783651134.tar.gz
slx-admin-47657731433248410e681640b2a53c0783651134.tar.xz
slx-admin-47657731433248410e681640b2a53c0783651134.zip
Add support to declare multiple css/js per module with loading condition:
A css/js can be declared to only load if the module in question is the page module being rendered, or to always be loaded even if the module is just a dependency. The second case is useful for plugin type modules. See one of the config.json files updated in this commit on how to specify css/js to load. true = always load, false = only if page module.
Diffstat (limited to 'inc/render.inc.php')
-rw-r--r--inc/render.inc.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/inc/render.inc.php b/inc/render.inc.php
index 72993ab5..53e2f314 100644
--- a/inc/render.inc.php
+++ b/inc/render.inc.php
@@ -51,7 +51,9 @@ class Render
public static function output()
{
Header('Content-Type: text/html; charset=utf-8');
+ /* @var $modules Module[] */
$modules = array_reverse(Module::getActivated());
+ $pageModule = Page::getModule();
$title = Property::get('page-title-prefix', '');
$bgcolor = Property::get('logo-background', '');
if (!empty($bgcolor) || !empty($title)) {
@@ -79,9 +81,9 @@ class Render
';
// Include any module specific styles
foreach ($modules as $module) {
- $file = $module->getDir() . '/style.css';
- if (file_exists($file)) {
- echo '<link href="', $file, '" rel="stylesheet" media="screen">';
+ $files = $module->getCss($module != $pageModule);
+ foreach ($files as $file) {
+ echo '<link href="', $module->getDir(), '/', $file, '" rel="stylesheet" media="screen">';
}
}
echo '
@@ -109,9 +111,9 @@ class Render
<script src="script/collapse.js"></script>
';
foreach ($modules as $module) {
- $file = $module->getDir() . '/clientscript.js';
- if (file_exists($file)) {
- echo '<script src="', $file, '"></script>';
+ $files = $module->getScripts($module != $pageModule);
+ foreach ($files as $file) {
+ echo '<script src="', $module->getDir(), '/', $file, '"></script>';
}
}
echo