function MenuTreeStorage::loadMultiple

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadMultiple()
  2. 10 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadMultiple()
  3. 11.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadMultiple()

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 713

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, NULL, $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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.