/**
  * @inheritdoc
  */
 protected function ensureModelInternal($model)
 {
     parent::ensureModelInternal($model);
     if (!$model->getBehavior('position')) {
         throw new \LogicException('Model should have position behavior');
     }
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     // @todo Yii::t() yii2-crud
     if (!isset($this->flashSuccess)) {
         $this->flashSuccess = Yii::t('yii2-crud', 'Action successfully executed');
     }
     if (!isset($this->flashError)) {
         $this->flashError = Yii::t('yii2-crud', 'Action execution failed');
     }
     if (is_callable($this->beforeCrudAction)) {
         $this->on(static::EVENT_BEFORE_CRUD_ACTION, $this->beforeCrudAction);
     }
     if (is_callable($this->afterCrudAction)) {
         $this->on(static::EVENT_AFTER_CRUD_ACTION, $this->afterCrudAction);
     }
     parent::init();
 }