function cer_profile2_cer_fields_alter in Corresponding Entity References 7.3
Implements hook_cer_fields_alter().
File
- extensions/
cer_profile2/ cer_profile2.cer.inc, line 21
Code
function cer_profile2_cer_fields_alter(array &$fields) {
foreach (array_keys($fields) as $identifier) {
list($entity_type, $bundle) = explode(':', $identifier);
// If this field is instantiated on a Profile2, make CER treat it like a field
// collection by first setting its parent field, and setting the 'require parent'
// flag so that CER won't allow it to stand alone in a field chain.
if ($entity_type == 'profile2') {
$fields[$identifier]['parents'][] = "user:user:profile_{$bundle}";
$fields[$identifier]['require parent'] = TRUE;
}
}
}