| @@ 234-248 (lines=15) @@ | ||
| 231 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 232 | * @return \Cake\Validation\Validator |
|
| 233 | */ |
|
| 234 | public function validationCustom(Validator $validator) |
|
| 235 | { |
|
| 236 | return $this->validationWidget($validator) |
|
| 237 | ->requirePresence('body') |
|
| 238 | ->add('body', [ |
|
| 239 | 'notBlank' => [ |
|
| 240 | 'rule' => 'notBlank', |
|
| 241 | 'message' => __d('block', "You need to provide a content for block's body."), |
|
| 242 | ], |
|
| 243 | 'length' => [ |
|
| 244 | 'rule' => ['minLength', 3], |
|
| 245 | 'message' => __d('block', "Block's body need to be at least 3 characters long."), |
|
| 246 | ], |
|
| 247 | ]); |
|
| 248 | } |
|
| 249 | ||
| 250 | ||
| 251 | /** |
|
| @@ 101-117 (lines=17) @@ | ||
| 98 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 99 | * @return \Cake\Validation\Validator |
|
| 100 | */ |
|
| 101 | public function validationDefault(Validator $validator) |
|
| 102 | { |
|
| 103 | $validator |
|
| 104 | ->notEmpty('handler', __d('field', 'Invalid field type.')) |
|
| 105 | ->add('label', [ |
|
| 106 | 'notBlank' => [ |
|
| 107 | 'rule' => 'notBlank', |
|
| 108 | 'message' => __d('field', 'You need to provide a label.'), |
|
| 109 | ], |
|
| 110 | 'length' => [ |
|
| 111 | 'rule' => ['minLength', 3], |
|
| 112 | 'message' => __d('field', 'Label need to be at least 3 characters long'), |
|
| 113 | ], |
|
| 114 | ]); |
|
| 115 | ||
| 116 | return $validator; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Instance's settings validator. |
|
| @@ 46-62 (lines=17) @@ | ||
| 43 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 44 | * @return \Cake\Validation\Validator |
|
| 45 | */ |
|
| 46 | public function validationDefault(Validator $validator) |
|
| 47 | { |
|
| 48 | $validator |
|
| 49 | ->add('name', [ |
|
| 50 | 'notBlank' => [ |
|
| 51 | 'rule' => 'notBlank', |
|
| 52 | 'message' => __d('locale', 'You need to provide a language name.'), |
|
| 53 | ], |
|
| 54 | 'length' => [ |
|
| 55 | 'rule' => ['minLength', 3], |
|
| 56 | 'message' => __d('locale', 'Language name need to be at least 3 characters long.'), |
|
| 57 | ], |
|
| 58 | ]) |
|
| 59 | ->requirePresence('code'); |
|
| 60 | ||
| 61 | return $validator; |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Regenerates system's snapshot. |
|
| @@ 51-67 (lines=17) @@ | ||
| 48 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 49 | * @return \Cake\Validation\Validator |
|
| 50 | */ |
|
| 51 | public function validationDefault(Validator $validator) |
|
| 52 | { |
|
| 53 | $validator |
|
| 54 | ->requirePresence('name') |
|
| 55 | ->add('name', [ |
|
| 56 | 'notBlank' => [ |
|
| 57 | 'rule' => 'notBlank', |
|
| 58 | 'message' => __d('taxonomy', 'You need to provide a name.'), |
|
| 59 | ], |
|
| 60 | 'length' => [ |
|
| 61 | 'rule' => ['minLength', 3], |
|
| 62 | 'message' => __d('taxonomy', 'Name need to be at least 3 characters long.'), |
|
| 63 | ], |
|
| 64 | ]); |
|
| 65 | ||
| 66 | return $validator; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| @@ 46-62 (lines=17) @@ | ||
| 43 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 44 | * @return \Cake\Validation\Validator |
|
| 45 | */ |
|
| 46 | public function validationDefault(Validator $validator) |
|
| 47 | { |
|
| 48 | $validator |
|
| 49 | ->requirePresence('name') |
|
| 50 | ->add('name', [ |
|
| 51 | 'notBlank' => [ |
|
| 52 | 'rule' => 'notBlank', |
|
| 53 | 'message' => __d('taxonomy', 'You need to provide a name.'), |
|
| 54 | ], |
|
| 55 | 'length' => [ |
|
| 56 | 'rule' => ['minLength', 3], |
|
| 57 | 'message' => __d('taxonomy', 'Name need to be at least 3 characters long.'), |
|
| 58 | ], |
|
| 59 | ]); |
|
| 60 | ||
| 61 | return $validator; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 41-57 (lines=17) @@ | ||
| 38 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 39 | * @return \Cake\Validation\Validator |
|
| 40 | */ |
|
| 41 | public function validationDefault(Validator $validator) |
|
| 42 | { |
|
| 43 | $validator |
|
| 44 | ->requirePresence('name') |
|
| 45 | ->add('name', [ |
|
| 46 | 'notBlank' => [ |
|
| 47 | 'rule' => 'notBlank', |
|
| 48 | 'message' => __d('user', 'You need to provide a role name.'), |
|
| 49 | ], |
|
| 50 | 'length' => [ |
|
| 51 | 'rule' => ['minLength', 3], |
|
| 52 | 'message' => __d('user', 'Role name need to be at least 3 characters long.'), |
|
| 53 | ], |
|
| 54 | ]); |
|
| 55 | ||
| 56 | return $validator; |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 179-194 (lines=16) @@ | ||
| 176 | * @param \Cake\Validation\Validator $validator The validator object |
|
| 177 | * @return \Cake\Validation\Validator |
|
| 178 | */ |
|
| 179 | public function validationDefault(Validator $validator) |
|
| 180 | { |
|
| 181 | $validator |
|
| 182 | ->add('title', [ |
|
| 183 | 'notBlank' => [ |
|
| 184 | 'rule' => 'notBlank', |
|
| 185 | 'message' => __d('content', 'You need to provide a title.'), |
|
| 186 | ], |
|
| 187 | 'length' => [ |
|
| 188 | 'rule' => ['minLength', 3], |
|
| 189 | 'message' => __d('content', 'Title need to be at least 3 characters long.'), |
|
| 190 | ], |
|
| 191 | ]); |
|
| 192 | ||
| 193 | return $validator; |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * This callback performs two action, saving revisions and checking publishing |
|