*/ public function rules() { $fileTypes = [ 'png', 'jpeg', 'jpg', 'bmp', 'gif', 'svg' ]; if ($this->offsetExists('type') && $this->get('type') === 'files') { $fileTypes = []; } return [ 'url' => ['required', new StorageFile(self::FORM_ASSET_MAX_SIZE, $fileTypes)], ]; } }