Backend\Modules\Pages\Actions\Add::execute PHP Method

execute() public method

Execute the action
public execute ( )
    public function execute()
    {
        // call parent, this will probably add some general CSS/JS or other required files
        parent::execute();
        // add js
        $this->header->addJS('jstree/jquery.tree.js', null, false);
        $this->header->addJS('jstree/lib/jquery.cookie.js', null, false);
        $this->header->addJS('jstree/plugins/jquery.tree.cookie.js', null, false);
        // get the templates
        $this->templates = BackendExtensionsModel::getTemplates();
        $this->isGod = BackendAuthentication::getUser()->isGod();
        // init var
        $defaultTemplateId = $this->get('fork.settings')->get('Pages', 'default_template', false);
        // fallback
        if ($defaultTemplateId === false) {
            // get first key
            $keys = array_keys($this->templates);
            // set the first items as default if no template was set as default.
            $defaultTemplateId = $this->templates[$keys[0]]['id'];
        }
        // set the default template as checked
        $this->templates[$defaultTemplateId]['checked'] = true;
        // get the extras
        $this->extras = BackendExtensionsModel::getExtras();
        $this->loadForm();
        $this->validateForm();
        $this->parse();
        $this->display();
    }