parentSelectOptionsTreeWalk example

$options[$menu_name . ':'] = '<' . $menu_title . '>';

      $parameters = new MenuTreeParameters();
      $parameters->setMaxDepth($depth_limit);
      $tree = $this->menuLinkTree->load($menu_name$parameters);
      $manipulators = [
        ['callable' => 'menu.default_tree_manipulators:checkNodeAccess'],
        ['callable' => 'menu.default_tree_manipulators:checkAccess'],
        ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
      ];
      $tree = $this->menuLinkTree->transform($tree$manipulators);
      $this->parentSelectOptionsTreeWalk($tree$menu_name, '--', $options$id$depth_limit$cacheability);
    }
    return $options;
  }

  /** * {@inheritdoc} */
  public function parentSelectElement($menu_parent$id = '', array $menus = NULL) {
    $options_cacheability = new CacheableMetadata();
    $options = $this->getParentSelectOptions($id$menus$options_cacheability);
    // If no options were found, there is nothing to select.
Home | Imprint | This part of the site doesn't use cookies.