function user_reference_relation_migrate_type_target_validate in Relation 8
Same name and namespace in other branches
- 8.2 relation_migrate/relation_migrate.modules.inc \user_reference_relation_migrate_type_target_validate()
- 7 relation_migrate/relation_migrate.modules.inc \user_reference_relation_migrate_type_target_validate()
Implements hook_relation_migrate_type_target_validate().
File
- relation_migrate/
relation_migrate.modules.inc, line 30 - s Hook implementations in behalf of core and supported contrib modules.
Code
function user_reference_relation_migrate_type_target_validate($element, $form_state, $form) {
$fields = array_filter($form_state['input']['relation_migrate_user_reference_fields']);
if (empty($fields)) {
return TRUE;
}
$relation_type = RelationType::load($form_state['input']['relation_migrate_user_reference_relation_type']);
$supported_bundles = $relation_type->directional ? $relation_type->target_bundles : $relation_type->source_bundles;
foreach ($supported_bundles as $bundle) {
if (strpos($bundle, 'user:') !== FALSE) {
return TRUE;
}
}
return FALSE;
}