Skip to content
Snippets Groups Projects

Issue #3345071: Add menu setting type

3 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
61 ContainerInterface $container,
62 array $configuration,
63 $plugin_id,
64 $plugin_definition
65 ) {
66 $plugin = new static(
67 $configuration,
68 $plugin_id,
69 $plugin_definition,
70 $container->get('module_handler'),
71 $container->get('entity_type.manager'),
72 $container->get('menu.link_tree'),
73 $container->get('breadcrumb'),
74 );
75 /** @var \Drupal\Core\StringTranslation\TranslationInterface $translation */
76 $translation = $container->get('string_translation');
  • 151 if (empty($value["menu"])) {
    152 // The value comes from the plugin setting, but no menu was selected.
    153 return [];
    154 }
    155 if ("_breadcrumb" === $value["menu"]) {
    156 return $this->getBreadcrumbItems();
    157 }
    158
    159 return $this->getMenuItems($value);
    160 }
    161
    162 /**
    163 * Get breadcrumb items.
    164 */
    165 private function getBreadcrumbItems(): array {
    166 $breadcrumb = $this->breadcrumbManager->build($this->routeMatch);
  • 180 private function getMenuItems($value): array {
    181 $level = (int) \array_key_exists("level", $value) ? $value["level"] : 1;
    182 $depth = (int) \array_key_exists("depth", $value) ? $value["depth"] : 0;
    183 $parameters = new MenuTreeParameters();
    184 $parameters->setMinDepth($level);
    185
    186 // When the depth is configured to zero, there is no depth limit. When depth
    187 // is non-zero, it indicates the number of levels that must be displayed.
    188 // Hence this is a relative depth that we must convert to an actual
    189 // (absolute) depth, that may never exceed the maximum depth.
    190 if ($depth > 0) {
    191 $parameters->setMaxDepth(min($level + $depth - 1, $this->menuLinkTree->maxDepth()));
    192 }
    193
    194 $tree = $this->menuLinkTree->load($value["menu"], $parameters);
    195 $manipulators = [
  • Pierre Dureau added 5 commits

    added 5 commits

    Compare with previous version

  • Pierre Dureau added 1 commit

    added 1 commit

    • ec12b4b5 - Issue #3345071: Cache management, URL attributes, presenter templates

    Compare with previous version

  • Pierre Dureau added 1 commit

    added 1 commit

    Compare with previous version

  • Pierre Dureau added 6 commits

    added 6 commits

    Compare with previous version

  • Pierre Dureau added 1 commit

    added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading