/**
* Returns the maximum depth of the possible parents of the menu link.
*
* @param string $id
* The menu link plugin ID or an empty value for a new link.
*
* @return int
* The depth related to the depth of the given menu link.
*/
protected function getParentDepthLimit($id) { if ($id) { $limit =
$this->menuLinkTree->
maxDepth() -
$this->menuLinkTree->
getSubtreeHeight($id);
} else { $limit =
$this->menuLinkTree->
maxDepth() - 1;
} return $limit;
} /**
* Iterates over all items in the tree to prepare the parents select options.
*
* @param \Drupal\Core\Menu\MenuLinkTreeElement[] $tree
* The menu tree.
* @param string $menu_name
* The menu name.
* @param string $indent
* The indentation string used for the label.
* @param array $options
* The select options.
* @param string $exclude
* An excluded menu link.
* @param int $depth_limit
* The maximum depth of menu links considered for the select options.
* @param \Drupal\Core\Cache\CacheableMetadata|null &$cacheability
* The object to add cacheability metadata to, if not NULL.
*/