示例#1
0
文件: editor.php 项目: cepharum/txf
 /**
  * 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;
 }