function MenuTreeStorage::loadByProperties
Same name in other branches
- 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadByProperties()
- 10 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadByProperties()
- 11.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadByProperties()
Overrides MenuTreeStorageInterface::loadByProperties
2 calls to MenuTreeStorage::loadByProperties()
- MenuTreeStorage::delete in core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php - Deletes a menu link definition from the storage.
- MenuTreeStorage::purgeMultiple in core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php - Purges multiple menu links that no longer exist.
File
-
core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 660
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
public function loadByProperties(array $properties) {
$query = $this->connection
->select($this->table, $this->options);
$query->fields($this->table, $this->definitionFields());
foreach ($properties as $name => $value) {
if (!in_array($name, $this->definitionFields(), TRUE)) {
$fields = implode(', ', $this->definitionFields());
throw new \InvalidArgumentException("An invalid property name, {$name} was specified. Allowed property names are: {$fields}.");
}
$query->condition($name, $value);
}
$loaded = $this->safeExecuteSelect($query)
->fetchAllAssoc('id', \PDO::FETCH_ASSOC);
foreach ($loaded as $id => $link) {
$loaded[$id] = $this->prepareLink($link);
}
return $loaded;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.