Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-11-23 06:27:50 +0400
committermattab <matthieu.aubry@gmail.com>2013-11-23 06:27:50 +0400
commitbe3f817ecb0297e2f06d94e198d476374b09743a (patch)
tree1477229088899e550ea7a5c19f959cbda5cbfec1 /core/Theme.php
parentce90029718501c1cc4fd231e20531210c7372c54 (diff)
Refs #4127 #3942 Allow plugins to define one or several javascript that the theme should include, directly from the plugin.json file.
It is better than asking Theme designers to create a .php file that defines the hook "AssetManager.getJavaScriptFiles"
Diffstat (limited to 'core/Theme.php')
-rw-r--r--core/Theme.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/Theme.php b/core/Theme.php
index 604cfa5543..699783ae46 100644
--- a/core/Theme.php
+++ b/core/Theme.php
@@ -43,6 +43,26 @@ class Theme
return $themeStylesheet;
}
+ public function getJavaScriptFiles()
+ {
+ if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) {
+ return false;
+ }
+
+ $info = $this->theme->getInformation();
+ if (empty($info['javascript'])) {
+ return false;
+ }
+ $jsFiles = $info['javascript'];
+ if(!is_array($jsFiles)) {
+ $jsFiles = array($jsFiles);
+ }
+ foreach($jsFiles as &$jsFile) {
+ $jsFile = 'plugins/' . $this->theme->getPluginName() . '/' . $jsFile;
+ }
+ return $jsFiles;
+ }
+
public function rewriteAssetsPathToTheme($output)
{
if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) {