@@ 273-293 (lines=21) @@ | ||
270 | /** |
|
271 | * @return \ValidationResult |
|
272 | */ |
|
273 | protected function validate() { |
|
274 | $validation = parent::validate(); |
|
275 | ||
276 | if (! empty($this->URL) && $this->Type != 'File') { |
|
277 | try { |
|
278 | $result = $this->getVideoId(); |
|
279 | } catch (ProviderNotFound $ex) { |
|
280 | $validation->error($ex->getMessage()); |
|
281 | ||
282 | return $validation; |
|
283 | } |
|
284 | ||
285 | // if we can't parse url address, return an error with bad url address or |
|
286 | // the type is not of the url address providers. |
|
287 | if (! $result) { |
|
288 | $validation->error(_t('VideoSliderItem.INVALID_URL_ADDRESS_OR_THE_TYPE', 'Invalid URL address or the type')); |
|
289 | } |
|
290 | } |
|
291 | ||
292 | return $validation; |
|
293 | } |
|
294 | ||
295 | /** |
|
296 | * @return Image|false |
@@ 225-245 (lines=21) @@ | ||
222 | /** |
|
223 | * @return \ValidationResult |
|
224 | */ |
|
225 | protected function validate() { |
|
226 | $validation = parent::validate(); |
|
227 | ||
228 | if (! empty($this->URL) && $this->Type != 'File') { |
|
229 | try { |
|
230 | $result = $this->getVideoId(); |
|
231 | } catch (ProviderNotFound $ex) { |
|
232 | $validation->error($ex->getMessage()); |
|
233 | ||
234 | return $validation; |
|
235 | } |
|
236 | ||
237 | // if we can't parse url address, return an error with bad url address or |
|
238 | // the type is not of the url address providers. |
|
239 | if (! $result) { |
|
240 | $validation->error(_t('VideoSliderItem.INVALID_URL_ADDRESS_OR_THE_TYPE', 'Invalid URL address or the type')); |
|
241 | } |
|
242 | } |
|
243 | ||
244 | return $validation; |
|
245 | } |
|
246 | ||
247 | /** |
|
248 | * @return Image|false |