function node_reference_relation_migrate_type_target_validate in Relation 7
Same name and namespace in other branches
- 8.2 relation_migrate/relation_migrate.modules.inc \node_reference_relation_migrate_type_target_validate()
- 8 relation_migrate/relation_migrate.modules.inc \node_reference_relation_migrate_type_target_validate()
Implements hook_relation_migrate_type_target_validate().
File
- relation_migrate/
relation_migrate.modules.inc, line 48 - s Hook implementations in behalf of core and supported contrib modules.
Code
function node_reference_relation_migrate_type_target_validate($element, $form_state, $form) {
$fields = array_filter($form_state['input']['relation_migrate_node_reference_fields']);
$relation_type = relation_type_load($form_state['input']['relation_migrate_node_reference_relation_type']);
$supported_bundles = $relation_type->directional ? $relation_type->target_bundles : $relation_type->source_bundles;
$return = TRUE;
foreach ($fields as $field) {
$field_def = field_info_field($field);
$node_types = array_filter($field_def['settings']['referenceable_types']);
foreach ($node_types as $node_type) {
$return &= in_array('node:' . $node_type, $supported_bundles);
}
}
return in_array('node:*', $supported_bundles) || $return;
}