added panels position

This commit is contained in:
Tobias Munk
2014-02-07 00:38:44 +01:00
parent a872d60503
commit d4c3c356bb

View File

@@ -41,6 +41,10 @@ class Module extends \yii\base\Module
* @var array|Panel[]
*/
public $panels = [];
/**
* @var string postion of the custom configured panels 'begin' or 'end'
*/
public $panelsPosition = 'end';
/**
* @var string the directory storing the debugger data files. This can be specified using a path alias.
*/
@@ -64,7 +68,15 @@ class Module extends \yii\base\Module
Yii::$app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
});
$this->panels = ArrayHelper::merge($this->corePanels(), $this->panels);
switch ($this->panelsPosition) {
case 'begin':
$this->panels = ArrayHelper::merge($this->panels, $this->corePanels());
break;
case 'end':
default:
$this->panels = ArrayHelper::merge($this->corePanels(), $this->panels);
break;
}
foreach ($this->panels as $id => $config) {
$config['module'] = $this;
$config['id'] = $id;