Exemple #1
0
 public function getSeo()
 {
     if ($model = Seo::find()->where(['item_id' => $this->owner->id, 'modelName' => $this->owner->className()])->one()) {
         return $model;
     } else {
         return new Seo();
     }
 }
Exemple #2
0
 public function run()
 {
     if (!$this->model->isNewRecord) {
         if (($this->model = Seo::findOne(['item_id' => $this->model->id, 'modelName' => $this->modelName])) === null) {
             $this->model = new Seo();
         }
     } else {
         $this->model = new Seo();
     }
     $content = [];
     $content[] = $this->form->field($this->model, 'modelName')->hiddenInput(['value' => $this->modelName])->label(false);
     $content[] = $this->form->field($this->model, 'title')->textInput(['maxlength' => true]);
     $content[] = $this->form->field($this->model, 'description')->textInput(['maxlength' => true]);
     $content[] = $this->form->field($this->model, 'keywords')->textInput(['maxlength' => true]);
     $content[] = $this->form->field($this->model, 'h1')->textInput(['maxlength' => true]);
     $content[] = $this->form->field($this->model, 'text')->textarea(['rows' => 6]);
     $content[] = $this->form->field($this->model, 'meta_index')->textInput(['maxlength' => true]);
     $content[] = $this->form->field($this->model, 'redirect_301')->textInput(['maxlength' => true]);
     $title = Html::a($this->title, '#seo-body', ['class' => 'toggle']);
     $heading = Html::tag('div', $title, ['class' => 'panel-heading']);
     $body = Html::tag('div', implode('', $content), ['class' => 'panel-body', 'id' => 'seo-body', 'style' => 'display:none;']);
     $view = Html::tag('div', $heading . $body, ['class' => 'panel panel-default pistol88-seo']);
     return $view;
 }