On this page
protected function MenuTreeStorage::saveRecursive
protected MenuTreeStorage::saveRecursive($id, &$children, &$links)
Saves menu links recursively.
Parameters
string $id: The definition ID.
array $children: An array of IDs of child links collected by parent ID.
array $links: An array of all definitions keyed by ID.
File
- core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 811
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
protected function saveRecursive($id, &$children, &$links) {
if (!empty($links[$id]['parent']) && empty($links[$links[$id]['parent']])) {
// Invalid parent ID, so remove it.
$links[$id]['parent'] = '';
}
$this->doSave($links[$id]);
if (!empty($children[$id])) {
foreach ($children[$id] as $next_id) {
$this->saveRecursive($next_id, $children, $links);
}
}
// Remove processed link names so we can find stragglers.
unset($children[$id]);
}
© 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::saveRecursive/8.1.x