Prado\Web\UI\TTemplateControl::initRecursive PHP 메소드

initRecursive() 보호된 메소드

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.
protected initRecursive ( $namingContainer = null )
    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);
    }