public function FeedsEntityProcessorPropertyEntity::validate in Feeds entity processor 7
Implements FeedsEntityProcessorPropertyInterface::validate().
Overrides FeedsEntityProcessorPropertyDefault::validate
File
- src/
Property/ FeedsEntityProcessorPropertyEntity.php, line 67 - Contains FeedsEntityProcessorPropertyEntity.
Class
- FeedsEntityProcessorPropertyEntity
- Handler for entity property.
Code
public function validate(&$value) {
if (!empty($value['entity_type']) && !empty($value['entity_id'])) {
$entity = entity_load_single($value['entity_type'], $value['entity_id']);
if (!$entity) {
$entity_types = $this
->getEntityTypeOptions();
return array(
t('@entity_type with ID "@entity_id" does not exist.', array(
'@entity_type' => $entity_types[$value['entity_type']],
'@entity_id' => $value['entity_id'],
)),
);
}
$wrapper = entity_metadata_wrapper($value['entity_type'], $value['entity_id']);
return parent::validate($wrapper);
}
}