You are here

public function MenuTreeStorage::loadMultiple in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadMultiple()

Loads multiple plugin definitions from the storage.

Parameters

array $ids: An array of plugin IDs.

Return value

array An array of plugin definition arrays keyed by plugin ID, which are the actual definitions after the loadMultiple() including all those plugins from $ids.

Overrides MenuTreeStorageInterface::loadMultiple

1 call to MenuTreeStorage::loadMultiple()
MenuTreeStorage::load in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Loads a menu link plugin definition from the storage.

File

core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 697
Contains \Drupal\Core\Menu\MenuTreeStorage.

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\Core\Menu

Code

public function loadMultiple(array $ids) {
  $missing_ids = array_diff($ids, array_keys($this->definitions));
  if ($missing_ids) {
    $query = $this->connection
      ->select($this->table, $this->options);
    $query
      ->fields($this->table, $this
      ->definitionFields());
    $query
      ->condition('id', $missing_ids, 'IN');
    $loaded = $this
      ->safeExecuteSelect($query)
      ->fetchAllAssoc('id', \PDO::FETCH_ASSOC);
    foreach ($loaded as $id => $link) {
      $this->definitions[$id] = $this
        ->prepareLink($link);
    }
  }
  return array_intersect_key($this->definitions, array_flip($ids));
}