Exemplo n.º 1
0
 private function checkIfFileBehaviorIsAttached()
 {
     $behaviors = $this->model->behaviors;
     foreach ($behaviors as $behavior) {
         if ($behavior::className() === FileBehavior::className()) {
             return true;
         }
     }
     $model = $this->model;
     throw new \Exception("To use FileUpload widgets, FileBehavior should be attached to the {$model::className()}.");
 }
Exemplo n.º 2
0
Arquivo: Page.php Projeto: ahb360/cms
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => FileBehavior::className(), 'groups' => ['image' => ['type' => FileBehavior::TYPE_IMAGE]]]]);
 }
Exemplo n.º 3
0
Arquivo: Page.php Projeto: ahb360/cms
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [TimestampBehavior::className(), ['class' => FileBehavior::className(), 'groups' => ['image' => ['type' => FileBehavior::TYPE_IMAGE, 'rules' => ['extensions' => ['png', 'jpg', 'jpeg'], 'maxSize' => 1024 * 1024]]]]]);
 }