public function FeedsEntityProcessorPropertyDate::validate in Feeds entity processor 7
Implements FeedsEntityProcessorPropertyInterface::validate().
Overrides FeedsEntityProcessorPropertyDefault::validate
File
- src/
Property/ FeedsEntityProcessorPropertyDate.php, line 31 - Contains FeedsEntityProcessorPropertyDate.
Class
- FeedsEntityProcessorPropertyDate
- Handler for date property.
Code
public function validate(&$value) {
// Entity API won't accept empty date values.
if (empty($value)) {
$value = NULL;
return array();
}
// Convert the date value.
if (module_exists('date_api') && !is_numeric($value)) {
$date = $this
->convertDate($value);
// Prevent to save the conversion for the config form.
$date_value = $date
->format('U');
return parent::validate($date_value);
}
return parent::validate($value);
}