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));
}
doc_Drupal
2016-10-29 09:27:39
Comments
Leave a Comment

Please login to continue.