MenuTreeStorageInterface

Defines an interface for storing a menu tree containing menu link IDs. The tree contains a hierarchy of menu links which have an ID as well as a route name or external URL. Hierarchy interface \Drupal\Core\Menu\MenuTreeStorageInterface File core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php, line 11 Namespace Drupal\Core\Menu Members Name Modifiers Type Description MenuTreeStorageInterface::countMenuLinks public function Counts the total number of menu links in one m

MenuTreeStorage::__construct

public MenuTreeStorage::__construct(Connection $connection, CacheBackendInterface $menu_cache_backend, CacheTagsInvalidatorInterface $cache_tags_invalidator, $table, array $options = array()) Constructs a new \Drupal\Core\Menu\MenuTreeStorage. Parameters \Drupal\Core\Database\Connection $connection: A Database connection to use for reading and writing configuration data. \Drupal\Core\Cache\CacheBackendInterface $menu_cache_backend: Cache backend instance for the extracted tree data. \Drupal\Co

MenuTreeStorage::updateParentalStatus

protected MenuTreeStorage::updateParentalStatus(array $link) Sets has_children for the link's parent if it has visible children. Parameters array $link: The link to get a parent ID from. File core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 596 Class MenuTreeStorage Provides a menu tree storage using the database. Namespace Drupal\Core\Menu Code protected function updateParentalStatus(array $link) { // If parent is empty, there is nothing to update. if (!empty($link['parent']))

MenuTreeStorage::treeDataRecursive

protected MenuTreeStorage::treeDataRecursive(array &$links, array $parents, $depth) Builds the data representing a menu tree. The function is a bit complex because the rendering of a link depends on the next menu link. Parameters array $links: A flat array of menu links that are part of the menu. Each array element is an associative array of information about the menu link, containing the fields from the $this->table. This array must be ordered depth-first. MenuTreeStorage::loadTreeData

MenuTreeStorage::setParents

protected MenuTreeStorage::setParents(array &$fields, $parent, array $original) Sets the materialized path field values based on the parent. Parameters array $fields: The menu link. array|false $parent: The parent menu link. array $original: The original menu link. File core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 462 Class MenuTreeStorage Provides a menu tree storage using the database. Namespace Drupal\Core\Menu Code protected function setParents(array &$fields, $pare

MenuTreeStorage::serializedFields

protected MenuTreeStorage::serializedFields() Determines serialized fields in the storage. Return value array A list of fields that are serialized in the database. File core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 1176 Class MenuTreeStorage Provides a menu tree storage using the database. Namespace Drupal\Core\Menu Code protected function serializedFields() { if (empty($this->serializedFields)) { $schema = static::schemaDefinition(); foreach ($schema['fields'] as $

MenuTreeStorage::schemaDefinition

protected static MenuTreeStorage::schemaDefinition() Defines the schema for the tree table. Return value array The schema API definition for the SQL storage table. File core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 1204 Class MenuTreeStorage Provides a menu tree storage using the database. Namespace Drupal\Core\Menu Code protected static function schemaDefinition() { $schema = array( 'description' => 'Contains the menu tree hierarchy.', 'fields' => array( '

MenuTreeStorage::saveRecursive

protected MenuTreeStorage::saveRecursive($id, &$children, &$links) Saves menu links recursively. Parameters string $id: The definition ID. array $children: An array of IDs of child links collected by parent ID. array $links: An array of all definitions keyed by ID. File core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 811 Class MenuTreeStorage Provides a menu tree storage using the database. Namespace Drupal\Core\Menu Code protected function saveRecursive($id, &$childre

MenuTreeStorage::save

public MenuTreeStorage::save(array $link) Saves a plugin definition to the storage. Parameters array $definition: A definition for a \Drupal\Core\Menu\MenuLinkInterface plugin. Return value array The menu names affected by the save operation. This will be one menu name if the link is saved to the sane menu, or two if it is saved to a new menu. Throws \Exception Thrown if the storage back-end does not exist and could not be created. \Drupal\Component\Plugin\Exception\PluginException Thrown if

MenuTreeStorage::safeExecuteSelect

protected MenuTreeStorage::safeExecuteSelect(SelectInterface $query) Executes a select query while making sure the database table exists. Parameters \Drupal\Core\Database\Query\SelectInterface $query: The select object to be executed. Return value \Drupal\Core\Database\StatementInterface|null A prepared statement, or NULL if the query is not valid. Throws \Exception Thrown if the table could not be created or the database connection failed. File core/lib/Drupal/Core/Menu/MenuTreeStorage.php,