Backend\Modules\Extensions\Actions\EditThemeTemplate::loadData PHP Метод

loadData() приватный Метод

Load the record
private loadData ( )
    private function loadData()
    {
        // get record
        $this->id = $this->getParameter('id', 'int');
        // validate id
        if ($this->id === null || !BackendExtensionsModel::existsTemplate($this->id)) {
            $this->redirect(BackendModel::createURLForAction('ThemeTemplates') . '&error=non-existing');
        }
        // get the record
        $this->record = BackendExtensionsModel::getTemplate($this->id);
        // unserialize
        $this->record['data'] = unserialize($this->record['data']);
        $this->names = $this->record['data']['names'];
        if (isset($this->record['data']['default_extras_' . BL::getWorkingLanguage()])) {
            $this->extras = $this->record['data']['default_extras_' . BL::getWorkingLanguage()];
        } elseif (isset($this->record['data']['default_extras'])) {
            $this->extras = $this->record['data']['default_extras'];
        }
        if (!array_key_exists('image', (array) $this->record['data'])) {
            $this->record['data']['image'] = false;
        }
        // assign
        $this->tpl->assign('template', $this->record);
        // is the template being used
        $inUse = BackendExtensionsModel::isTemplateInUse($this->id);
        // determine if deleting is allowed
        $deleteAllowed = true;
        if ($this->record['id'] == $this->get('fork.settings')->get('Pages', 'default_template')) {
            $deleteAllowed = false;
        } elseif (count(BackendExtensionsModel::getTemplates()) == 1) {
            $deleteAllowed = false;
        } elseif ($inUse) {
            $deleteAllowed = false;
        }
        // assign
        $this->tpl->assign('inUse', $inUse);
        $this->tpl->assign('allowExtensionsDeleteThemeTemplate', $deleteAllowed);
    }