Confusion Or Maybe Bug With Modules Layout


Couple of hours I was struggling setting modules and its child modules layouts. Modules looks like:




                        'user', 'organization'



My idea is that parent admin and all child modules use admin’s layout declered in AdminModule.php:

public function init()



 $this->layoutPath = Yii::getPathOfAlias('application.modules.admin.views.layouts');

 $this->layout = 'column1';


} says:

layout roperty

“he layout that is shared by the controllers inside this module. If a controller has explicitly declared its own layout, this property will be ignored. If this is null (default), the application’s layout or the parent module’s layout (if available) will be used. If this is false, then no layout will be used.”

Looks ok, but in reality this don’t work and here why:


public function getLayoutFile($layoutName)


       // modules controller extends components/Controller and inherits layout property

      // whitch is '//layouts/column1' by default

       // so, by default its never empty or null or false


			return false;

		if(($theme=Yii::app()->getTheme())!==null && ($layoutFile=$theme->getLayoutFile($this,$layoutName))!==false)

			return $layoutFile;

                //by default this never applies - property not empty

                // in every child modules controller your have to declare layout property empty 







					return false;



                                // that's ok but...











// this always return false if I render view from child module

// it gets layout property from parent but looks for view file in own layout path, not parent



Main questions:

  1. Is it bug in documentation or in code? CControler layout

"Defaults to null, meaning the application layout is used. If it is false, no layout will be applied. The module layout will be used if the controller belongs to a module and this layout property is null"

It is ok if in components/Controller.php layout would’nt be declared at all else you have to set null or empty in child modules controller

  1. Is it ok if child modules gets layout property from parent module, but layout view file is search in child’s directory?

Thanks :)