function _domain_entity_get_related_domains in Domain Access Entity 8
Return domain IDs list assigned to the requested entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity object.
Return value
array Domain IDs list assigned to the requested entity.
1 call to _domain_entity_get_related_domains()
- domain_entity_entity_access in ./
domain_entity.module - Implements hook_entity_access().
File
- ./
domain_entity.module, line 539 - Enables domain access for entities, and access query alter.
Code
function _domain_entity_get_related_domains(EntityInterface $entity) {
$domains = [];
$values = $entity
->get(DomainEntityMapper::FIELD_NAME)
->getValue();
if (!$values) {
return $domains;
}
foreach ($values as $value) {
if (isset($value['target_id'])) {
$domains[$value['target_id']] = $value['target_id'];
}
}
return $domains;
}