function MenuTreeStorage::prepareLink

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

Prepares a link by unserializing values and saving the definition.

Parameters

array $link: The data loaded in the query.

bool $intersect: If TRUE, filter out values that are not part of the actual definition.

Return value

array The prepared link data.

5 calls to MenuTreeStorage::prepareLink()
MenuTreeStorage::loadAllChildren in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Loads all the enabled menu links that are below the given ID.
MenuTreeStorage::loadByProperties in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Loads multiple plugin definitions from the storage based on properties.
MenuTreeStorage::loadByRoute in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Loads multiple plugin definitions from the storage based on route.
MenuTreeStorage::loadMultiple in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Loads multiple plugin definitions from the storage.
MenuTreeStorage::treeDataRecursive in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Builds the data representing a menu tree.

File

core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 619

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\Core\Menu

Code

protected function prepareLink(array $link, $intersect = FALSE) {
    foreach ($this->serializedFields() as $name) {
        if (isset($link[$name])) {
            $link[$name] = unserialize($link[$name]);
        }
    }
    if ($intersect) {
        $link = array_intersect_key($link, array_flip($this->definitionFields()));
    }
    $this->definitions[$link['id']] = $link;
    return $link;
}

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