From what I understand I should be able to retrieve all the items in a menu using menuTree. However I only get one level/depth no matter what I try.
My Menu Looks Like:
Imported Content
--Products
----A Child
------Grand Child
--------Great Grandchild
------Grand Child 2
----Child 2
--A Sibling
Menu structure (screenshot): https://www.evernote.com/l/AAKdnwekb7BM87AFANo1z2XjCdEvR8HgDEI
This is my code:
$menu_name = 'imported-content-menu';
$menu_tree = \Drupal::menuTree();
$parameters = $menu_tree->getCurrentRouteMenuTreeParameters($menu_name);
$parameters->setMaxDepth(100);
$parameters->setMinDepth(0);
$tree = $menu_tree->load($menu_name, $parameters);
When I inspect $tree, it is an array of two items "Products" and "A Sibling".
I inspected these two items to see if there were nested items (the children) but there were not.
The "Products" item has 'hasChildren' set to TRUE. But I don't see those children.