protected function MenuTreeStorage::findNoLongerExistingLinks

protected MenuTreeStorage::findNoLongerExistingLinks(array $definitions)

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.

File

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

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 = array();
  }
  return $result;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!MenuTreeStorage.php/function/MenuTreeStorage::findNoLongerExistingLinks/8.1.x