function _cer_find_referrers in Corresponding Entity References 7.2
Find all fields that can reference the given entity type and bundle.
Parameters
$entity_type: The entity type that can be referenced.
$bundle: The bundle that can be referenced.
Return value
array
1 call to _cer_find_referrers()
- _cer_find_channels in ./
cer.admin.inc - The purpose of this function is to answer this question: I am a field instance. Which other fields reference the entity that owns me? And of those instances, which ones can I reference? The answer is returned as an array of CER keys: "entity1…
File
- ./
cer.admin.inc, line 200 - Administrative functionality, separated for performance purposes.
Code
function _cer_find_referrers($entity_type, $bundle) {
$referrers = array();
foreach (_cer_get_fields() as $field) {
if ($field['settings']['target_type'] == $entity_type) {
$target_bundles = _cer_get_target_bundles($field);
if (empty($target_bundles) || in_array($bundle, $target_bundles)) {
$referrers[] = $field;
}
}
}
return $referrers;
}