public function run()
 {
     $this->autoSavePath .= $this->parentType . '/' . $this->parentId;
     $this->options['id'] .= $this->parentId;
     $this->widgetOptions['id'] .= $this->parentId;
     switch ($this->_enableRevisions) {
         case true:
             $this->revisionsModel->setScenario('validateNew');
             $revisionOptions = ['role' => $this->options['role'], 'id' => $this->options['id'] . $this->parentId, 'data-dave-path' => $this->autoSavePath, 'data-use-redactor' => $this->enableRedactor];
             Asset::register($this->getView());
             break;
         default:
             $revisionOptions = [];
             break;
     }
     switch ($this->enableRedactor) {
         case true:
             $this->editorOptions['id'] = 'message' . uniqid();
             $this->editorOptions['model'] = $this->model;
             $this->editorOptions['attribute'] = $this->name;
             $this->editorOptions['options']['value'] = $this->value;
             $input = Editor::widget($this->editorOptions);
             break;
         default:
             $input = Html::activeTextarea($this->model, $this->name, $revisionOption);
             break;
     }
     $result = Html::tag('div', '', ['role' => 'revisionStatus']);
     echo Html::tag('div', $input . $result, $this->widgetOptions);
 }
Example #2
0
 public function init()
 {
     switch (1) {
         case !$this->model instanceof RevisionsModel && ($this->parentType == null || $this->parentId == null):
             $this->model = null;
             break;
         default:
             $this->model = $this->model instanceof RevisionsModel ? $this->model : (new RevisionsModel(['initSearchClass' => false]))->findModel([$this->parentId, $this->parentType]);
             break;
     }
     parent::init();
     Asset::register($this->getView());
 }