You are here

protected function MenuTreeStorage::prepareLink in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::prepareLink()
  2. 9 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.

File

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

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;
}