/** * Creates model editor used for editing page. * * @param string $editorName name of editor * @return model_editor created instance */ protected function createEditor($editorName) { $page = $this->getPage(); if ($page) { $editor = model_editor::createOnItem($this->dataSource, $page, $editorName); $pageName = $page->name; } else { $editor = model_editor::createOnModel($this->dataSource, $this->modelClass, $editorName); $pageName = $this->pageName; } $editor->addField('name', \de\toxa\txf\_L('Name'), model_editor_static::create()->setContent($pageName))->fixProperty('name', $pageName)->addField('title', \de\toxa\txf\_L('Title'), model_editor_text::create()->maximum(255)->trim(true)->collapseWhitespace(true)->mandatory())->addField('content', \de\toxa\txf\_L('Content'), model_editor_texteditor::create(10, 60)->mandatory()->setClass('rte')); return $editor; }
protected function prepareControl() { if (is_null($this->browser) && is_null($this->editor)) { if ($this->isListing()) { $this->browser = databrowser::create($this->modelClass->getMethod('browse')->invoke(null, $this->source)); } else { if ($this->item) { $this->editor = model_editor::createOnItem($this->source, $this->item); } else { $this->editor = model_editor::createOnModel($this->source, $this->modelClass); } } } return $this; }