mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Fixed Theming of topNavigation - #331
This commit is contained in:
parent
8788735ecf
commit
a1f5fe054a
@ -25,7 +25,8 @@
|
||||
* @package humhub.components
|
||||
* @since 0.5
|
||||
*/
|
||||
class HWidget extends CWidget {
|
||||
class HWidget extends CWidget
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array view paths for different types of widgets
|
||||
@ -45,16 +46,17 @@ class HWidget extends CWidget {
|
||||
* @param type $checkTheme
|
||||
* @return String
|
||||
*/
|
||||
public function getViewPath($checkTheme = false) {
|
||||
public function getViewPath($checkTheme = false)
|
||||
{
|
||||
|
||||
// Fastlane
|
||||
$className = get_class($this);
|
||||
|
||||
|
||||
|
||||
if ($checkTheme && ($theme = Yii::app()->getTheme()) !== null) {
|
||||
if (isset(self::$_viewPaths[$className]))
|
||||
return self::$_viewPaths[$className];
|
||||
|
||||
|
||||
// /themes/myTheme/views/
|
||||
$path = $theme->getViewPath() . DIRECTORY_SEPARATOR;
|
||||
|
||||
@ -71,7 +73,6 @@ class HWidget extends CWidget {
|
||||
$class = new ReflectionClass($className);
|
||||
return dirname($class->getFileName()) . DIRECTORY_SEPARATOR . 'views';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,20 +83,26 @@ class HWidget extends CWidget {
|
||||
* @return string the view file path. False if the view file does not exist
|
||||
* @see CApplication::findLocalizedFile
|
||||
*/
|
||||
public function getViewFile($viewName) {
|
||||
public function getViewFile($viewName)
|
||||
{
|
||||
|
||||
// a path alias e.g. application.modules.x.y.z.
|
||||
if (strpos($viewName, '.')) {
|
||||
|
||||
|
||||
if (($theme = Yii::app()->getTheme()) !== null) {
|
||||
// Replace application.modules[_core].MODULEID.widgets.views
|
||||
// in
|
||||
// webroot.themes.CURRENTTHEME.views.MODULEID.widgets
|
||||
$viewNameTheme = $viewName;
|
||||
|
||||
|
||||
|
||||
// Replace: application.views -> webroot.themes.CURRENTTHEME.views
|
||||
$viewNameTheme = str_replace('application.views.', 'webroot.themes.' . $theme->getName() . '.views.', $viewNameTheme);
|
||||
|
||||
// Replace: application.modules[_core].MODULEID.widgets.views -> webroot.themes.CURRENTTHEME.views.MODULEID.widgets
|
||||
$viewNameTheme = preg_replace('/application\.modules(?:_core)?\.(.*?)\.views\.(.*)/i', 'webroot.themes.' . $theme->getName() . '.views.\1.\2', $viewNameTheme);
|
||||
#$viewNameTheme = preg_replace('/widgets\.views/', 'widgets', $viewNameTheme);
|
||||
|
||||
// Replace: application.widget.views TO webroot.theme.THEMENAME.widget.views
|
||||
$viewNameTheme = str_replace('application.widgets.views', 'webroot.themes.' . $theme->getName() . '.views.widgets', $viewNameTheme);
|
||||
|
||||
$viewFile = Yii::getPathOfAlias($viewNameTheme);
|
||||
|
||||
@ -120,7 +127,8 @@ class HWidget extends CWidget {
|
||||
*
|
||||
* @return String The Id of Module
|
||||
*/
|
||||
public function getModuleId() {
|
||||
public function getModuleId()
|
||||
{
|
||||
|
||||
// Get Directory of current widget class
|
||||
$reflector = new ReflectionClass(get_class($this));
|
||||
@ -144,7 +152,8 @@ class HWidget extends CWidget {
|
||||
* @param String $ampersand
|
||||
* @return String url
|
||||
*/
|
||||
public function createUrl($action, $params = array(), $ampersand = '&') {
|
||||
public function createUrl($action, $params = array(), $ampersand = '&')
|
||||
{
|
||||
return $this->getController()->createUrl($this->actionPrefix . $action, $params, $ampersand);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
* @since 0.5
|
||||
* @author Luke
|
||||
*/
|
||||
class MenuWidget extends CWidget
|
||||
class MenuWidget extends HWidget
|
||||
{
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user