Esempio 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()}.");
 }
Esempio n. 2
0
File: Page.php Progetto: ahb360/cms
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => FileBehavior::className(), 'groups' => ['image' => ['type' => FileBehavior::TYPE_IMAGE]]]]);
 }
Esempio n. 3
0
File: Page.php Progetto: 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]]]]]);
 }