function relation_rules_get_specific_endpoints in Relation 8
Same name and namespace in other branches
- 8.2 relation.rules.inc \relation_rules_get_specific_endpoints()
- 7 relation.rules.inc \relation_rules_get_specific_endpoints()
Entity-type specific property getter callback.
File
- ./
relation.rules.inc, line 116 - Implements the Rules module API for Relation.
Code
function relation_rules_get_specific_endpoints($relation, array $options, $property_name, $entity_type, $info) {
if ($info['endpoint_type'] == 'source') {
if ($info['relation_directional']) {
$endpoints = array(
$relation->endpoints[Language::LANGCODE_NOT_SPECIFIED][0],
);
}
else {
$endpoints = $relation->endpoints[Language::LANGCODE_NOT_SPECIFIED];
}
}
else {
$endpoints = array_slice($relation->endpoints[Language::LANGCODE_NOT_SPECIFIED], 1);
}
$array = array();
foreach ($endpoints as $endpoint) {
$storage_handler = \Drupal::entityTypeManager()
->getStorage($endpoint['entity_type']);
$entity = $storage_handler
->load($endpoint['entity_id']);
$array[] = $entity
->id();
}
return $array;
}