public function MenuTreeStorage::loadMultiple

public MenuTreeStorage::loadMultiple(array $ids)

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

File

core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 692

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));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!MenuTreeStorage.php/function/MenuTreeStorage::loadMultiple/8.1.x