/** * Performs the OnInit step for the control and all its child controls. * This method overrides the parent implementation * by ensuring child controls are created first, * and if master class is set, master will be applied. * Only framework developers should use this method. * @param TControl the naming container control */ protected function initRecursive($namingContainer = null) { $this->ensureChildControls(); if ($this->_masterClass !== '') { $master = Prado::createComponent($this->_masterClass); if (!$master instanceof TTemplateControl) { throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); } $this->_master = $master; $this->getControls()->clear(); $this->getControls()->add($master); $master->ensureChildControls(); foreach ($this->_contents as $id => $content) { $master->injectContent($id, $content); } } else { if (!empty($this->_contents)) { throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); } } parent::initRecursive($namingContainer); }