class MenuTreeStorage in Menu Trail By Path 8
Hierarchy
- class \Drupal\Core\Menu\MenuTreeStorage implements MenuTreeStorageInterface
- class \Drupal\menu_trail_by_path\Menu\MenuTreeStorage implements MenuTreeStorageInterface
Expanded class hierarchy of MenuTreeStorage
1 string reference to 'MenuTreeStorage'
1 service uses MenuTreeStorage
File
- src/
Menu/ MenuTreeStorage.php, line 8
Namespace
Drupal\menu_trail_by_path\MenuView source
class MenuTreeStorage extends CoreMenuTreeStorage implements MenuTreeStorageInterface {
/**
* Same as parent, but with ordering
*
* {@inheritdoc}
*/
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);
}
// Make the ordering deterministic.
$query
->orderBy('depth');
$query
->orderBy('weight');
$query
->orderBy('id');
$loaded = $this
->safeExecuteSelect($query)
->fetchAllAssoc('id', \PDO::FETCH_ASSOC);
foreach ($loaded as $id => $link) {
$loaded[$id] = $this
->prepareLink($link);
}
return $loaded;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MenuTreeStorage:: |
protected | property | The cache tags invalidator. | |
MenuTreeStorage:: |
protected | property | The database connection. | |
MenuTreeStorage:: |
protected | property | List of plugin definition fields. | |
MenuTreeStorage:: |
protected | property | Stores definitions that have already been loaded for better performance. | |
MenuTreeStorage:: |
protected | property | Cache backend instance for the extracted tree data. | |
MenuTreeStorage:: |
protected | property | Additional database connection options to use in queries. | |
MenuTreeStorage:: |
protected | property | List of serialized fields. | |
MenuTreeStorage:: |
protected | property | The database table name. | |
MenuTreeStorage:: |
protected | function | Traverses the menu tree and collects all the route names and definitions. | |
MenuTreeStorage:: |
public | function |
Counts the total number of menu links in one menu or all menus. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
protected | function | Determines fields that are part of the plugin definition. | |
MenuTreeStorage:: |
public | function |
Deletes a menu link definition from the storage. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
protected | function | Prepares the data for calling $this->treeDataRecursive(). | |
MenuTreeStorage:: |
protected | function | Collects all the route names and definitions. | |
MenuTreeStorage:: |
protected | function | Purge menu links from the database. | |
MenuTreeStorage:: |
protected | function | Finds the relative depth of this link's deepest child. | |
MenuTreeStorage:: |
protected | function | Saves a link without clearing caches. | |
MenuTreeStorage:: |
protected | function | Checks if the tree table exists and create it if not. | |
MenuTreeStorage:: |
protected | function | Find any previously discovered menu links that no longer exist. | |
MenuTreeStorage:: |
protected | function | Loads the parent definition if it exists. | |
MenuTreeStorage:: |
public | function |
Loads all the IDs for menu links that are below the given ID. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Finds expanded links in a menu given a set of possible parents. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Returns the used menu names in the tree storage. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Returns all the IDs that represent the path to the root of the tree. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Finds the height of a subtree rooted by the given ID. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Loads a menu link plugin definition from the storage. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Loads all the enabled menu links that are below the given ID. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Same as parent, but with ordering Overrides MenuTreeStorage:: |
|
MenuTreeStorage:: |
public | function |
Loads multiple plugin definitions from the storage based on route. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
protected | function | Loads all table fields, not just those that are in the plugin definition. | |
MenuTreeStorage:: |
protected | function | Loads all table fields for multiple menu link definitions by ID. | |
MenuTreeStorage:: |
protected | function | Loads links in the given menu, according to the given tree parameters. | |
MenuTreeStorage:: |
public | function |
Loads multiple plugin definitions from the storage. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Loads a subtree rooted by the given ID. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Loads a menu link tree from the storage. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
The maximum depth of tree the storage implementation supports. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
constant | The maximum depth of a menu links tree. | ||
MenuTreeStorage:: |
public | function |
Determines whether a specific menu name is used in the tree. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
protected | function | Re-parents a link's children when the link itself is moved. | |
MenuTreeStorage:: |
protected | function | Prepares a link by unserializing values and saving the definition. | |
MenuTreeStorage:: |
protected | function | Fills in all the fields the database save needs, using the link definition. | |
MenuTreeStorage:: |
protected | function | Purges multiple menu links that no longer exist. | |
MenuTreeStorage:: |
public | function |
Rebuilds the stored menu link definitions. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
public | function |
Clears all definitions cached in memory. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
protected | function | Executes a select query while making sure the database table exists. | |
MenuTreeStorage:: |
public | function |
Saves a plugin definition to the storage. Overrides MenuTreeStorageInterface:: |
|
MenuTreeStorage:: |
protected | function | Saves menu links recursively. | |
MenuTreeStorage:: |
protected static | function | Defines the schema for the tree table. | |
MenuTreeStorage:: |
protected | function | Determines serialized fields in the storage. | |
MenuTreeStorage:: |
protected | function | Sets the materialized path field values based on the parent. | |
MenuTreeStorage:: |
protected | function | Builds the data representing a menu tree. | |
MenuTreeStorage:: |
protected | function | Sets has_children for the link's parent if it has visible children. | |
MenuTreeStorage:: |
public | function | Constructs a new \Drupal\Core\Menu\MenuTreeStorage. |