예제 #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()}.");
 }
예제 #2
0
파일: Page.php 프로젝트: ahb360/cms
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => FileBehavior::className(), 'groups' => ['image' => ['type' => FileBehavior::TYPE_IMAGE]]]]);
 }
예제 #3
0
파일: Page.php 프로젝트: 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]]]]]);
 }