function MenuTreeStorage::findNoLongerExistingLinks

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

Find any previously discovered menu links that no longer exist.

Parameters

array $definitions: The new menu link definitions.

Return value

array A list of menu link IDs that no longer exist.

1 call to MenuTreeStorage::findNoLongerExistingLinks()
MenuTreeStorage::rebuild in core/lib/Drupal/Core/Menu/MenuTreeStorage.php
Rebuilds the stored menu link definitions.

File

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

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\Core\Menu

Code

protected function findNoLongerExistingLinks(array $definitions) {
    if ($definitions) {
        $query = $this->connection
            ->select($this->table, NULL, $this->options);
        $query->addField($this->table, 'id');
        $query->condition('discovered', 1);
        $query->condition('id', array_keys($definitions), 'NOT IN');
        // Starting from links with the greatest depth will minimize the amount
        // of re-parenting done by the menu storage.
        $query->orderBy('depth', 'DESC');
        $result = $query->execute()
            ->fetchCol();
    }
    else {
        $result = [];
    }
    return $result;
}

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