Example #1
0
 /**
  * @inheritdoc
  */
 public function getAccessValues(EntityInterface $entity, $field_name = DOMAIN_ACCESS_FIELD)
 {
     // @TODO: static cache.
     $list = array();
     // @TODO In tests, $entity is returning NULL.
     if (is_null($entity)) {
         return $list;
     }
     // Get the values of an entity.
     $values = $entity->get($field_name);
     // Must be at least one item.
     if (!empty($values)) {
         foreach ($values as $item) {
             if ($target = $item->getValue()) {
                 if ($domain = $this->loader->load($target['target_id'])) {
                     $list[$domain->id()] = $domain->getDomainId();
                 }
             }
         }
     }
     return $list;
 }