You are here

public function FeedsEntityProcessorPropertyDefault::validate in Feeds entity processor 7

Implements FeedsEntityProcessorPropertyInterface::validate().

Overrides FeedsEntityProcessorPropertyInterface::validate

3 calls to FeedsEntityProcessorPropertyDefault::validate()
FeedsEntityProcessorPropertyDate::validate in src/Property/FeedsEntityProcessorPropertyDate.php
Implements FeedsEntityProcessorPropertyInterface::validate().
FeedsEntityProcessorPropertyEntity::validate in src/Property/FeedsEntityProcessorPropertyEntity.php
Implements FeedsEntityProcessorPropertyInterface::validate().
FeedsEntityProcessorPropertyEntityType::validate in src/Property/FeedsEntityProcessorPropertyEntityType.php
Implements FeedsEntityProcessorPropertyInterface::validate().
3 methods override FeedsEntityProcessorPropertyDefault::validate()
FeedsEntityProcessorPropertyDate::validate in src/Property/FeedsEntityProcessorPropertyDate.php
Implements FeedsEntityProcessorPropertyInterface::validate().
FeedsEntityProcessorPropertyEntity::validate in src/Property/FeedsEntityProcessorPropertyEntity.php
Implements FeedsEntityProcessorPropertyInterface::validate().
FeedsEntityProcessorPropertyEntityType::validate in src/Property/FeedsEntityProcessorPropertyEntityType.php
Implements FeedsEntityProcessorPropertyInterface::validate().

File

src/Property/FeedsEntityProcessorPropertyDefault.php, line 130
Contains FeedsEntityProcessorPropertyDefault.

Class

FeedsEntityProcessorPropertyDefault
Default handler for entity properties.

Code

public function validate(&$value) {
  $errors = array();
  $property_info = $this
    ->getPropertyInfo();
  if (entity_property_list_extract_type($property_info['type']) && !is_array($value)) {
    $value = array(
      $value,
    );
  }
  if ($value === '') {
    return $errors;
  }
  if (!entity_property_verify_data_type($value, $property_info['type'])) {
    $errors[] = t('Invalid data value given. Be sure it matches the required data type and format.');
  }
  return $errors;
}