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;
}
doc_Drupal
2016-10-29 09:27:36
Comments
Leave a Comment

Please login to continue.