From b6f26e58fd9152223221febf407fee5529244ffe Mon Sep 17 00:00:00 2001 From: mattab Date: Fri, 22 Nov 2013 17:01:07 +1300 Subject: Refs #4127 Implementing possibility for Themes to overwrite any icon or resource by putting the new file in plugins/$ThemeName/XX - Morpheus theme now displays its icons! :) --- core/Theme.php | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 core/Theme.php (limited to 'core/Theme.php') diff --git a/core/Theme.php b/core/Theme.php new file mode 100644 index 0000000000..1b69b57c59 --- /dev/null +++ b/core/Theme.php @@ -0,0 +1,95 @@ +theme = \Piwik\Plugin\Manager::getInstance()->getThemeEnabled(); + $this->themeName = $this->theme->getPluginName(); + } + + public function getStylesheet() + { + if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) { + return false; + } + + $info = $this->theme->getInformation(); + if (!isset($info['stylesheet'])) { + return false; + } + $themeStylesheet = 'plugins/' . $this->theme->getPluginName() . '/' . $info['stylesheet']; + return $themeStylesheet; + } + + public function rewriteAssetsPathToTheme($output) + { + if ($this->themeName == \Piwik\Plugin\Manager::DEFAULT_THEME) { + return; + } + + $pattern = array( + // Rewriting scripts includes to overrides + '~