You are here

protected function MetatagDefaultsListBuilder::getParentIds in Metatag 8

Gets the parent entity ids for the list of entities to load.

Parameters

array $entity_ids: The metatag entity ids.

Return value

array The list of parents to load

1 call to MetatagDefaultsListBuilder::getParentIds()
MetatagDefaultsListBuilder::getEntityIds in src/MetatagDefaultsListBuilder.php
Loads entity IDs using a pager sorted by the entity id.

File

src/MetatagDefaultsListBuilder.php, line 43

Class

MetatagDefaultsListBuilder
Provides a listing of Metatag defaults entities.

Namespace

Drupal\metatag

Code

protected function getParentIds(array $entity_ids) {
  $parents = [
    'global' => 'global',
  ];
  foreach ($entity_ids as $entity_id) {
    if (strpos($entity_id, '__') !== FALSE) {
      $entity_id_array = explode('__', $entity_id);
      $parent = reset($entity_id_array);
      $parents[$parent] = $parent;
    }
  }
  $parents_query = $this
    ->getStorage()
    ->getQuery()
    ->condition('id', $parents, 'IN');
  return $parents_query
    ->execute();
}