Ability to display "the menu selected by the page"

Created on 21 October 2019, over 5 years ago
Updated 9 February 2023, about 2 years ago

Issue to keep track of "Ability to display the menu selected by the page" implementation, as described on [Meta] Add missing features to Drupal 8 menu_block .

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇵🇹Portugal rutiolma

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇸🇪Sweden peter törnstrand

    I'm using this patch besides the one in #26 to at least get this thing working descently. But this is by no means done.

  • 🇧🇪Belgium ludo.r Brussels

    Re. #27

    I just ran into the same issue, I guess modifying MenuBlock::getDerivativeActiveTrailIds() should be enough.

      protected function getDerivativeActiveTrailIds() {
        $menu_id = $this->getDerivativeId();
    
        // => If menu_id = "multiple_menu_block", then do custom logic.
    
        return array_filter($this->menuActiveTrail->getActiveTrailIds($menu_id));
      }
    

    In the meantime I'm using classic Menu blocks (from core) and not the multiple one.

  • 🇫🇮Finland mitechworld

    Update the patch to support versions equal/greater than v1.8

  • 🇵🇹Portugal jrochate

    Currently none of the patches above works: 1.11

  • First commit to issue fork.
  • 🇵🇹Portugal lolgm

    lolgm changed the visibility of the branch 8.x-1.x to hidden.

  • 🇵🇹Portugal lolgm

    lolgm changed the visibility of the branch 3089134-ability-to-display to hidden.

  • 🇵🇹Portugal lolgm

    lolgm changed the visibility of the branch 3089134-ability-to-display to active.

  • Merge request !22Creation of the multiple menu block plugin. → (Open) created by lolgm
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Unable to generate test groups
  • Pipeline finished with Success
    9 months ago
    Total: 232s
    #185147
  • 🇵🇹Portugal lolgm

    I created !MR22 for version 1.11, based on previous patches.
    I also implemented a proposed solution to the block title, problem referred in #27 and #28.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 9 months ago
    11 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Unable to generate test groups
  • Pipeline finished with Success
    9 months ago
    Total: 314s
    #186969
  • 🇫🇮Finland mitechworld

    mitechworld changed the visibility of the branch 8.x-1.x to active.

  • Status changed to Needs review 8 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Patch Failed to Apply
  • 🇧🇪Belgium weseze

    MR22 works fine. (tried the patch from it against latest release)

    Can we get feedback from the maintainers?

  • 🇵🇹Portugal lolgm

    @weseze Thanks for the feedback.

    Using this functionality I found two use cases where the implementation was incomplete.

    1st - When a node is present in more than one menu, it is not possible to "prioritize" a menu to be the active one.

    2nd - When the current node is not present in any menu, and if the option "Hide on pages not included in menu" is not activated, the expected behavior is to render the default menu, however the default menu in the multiple block is the first menu from the configuration list, may not be the intended default.

    These two limitations occur due to the block configuration format being just a table with select, not sortable.

    In this way, I converted the selection table into a table with the option of dragging, so that it is now possible to select the menus you want and classify them in order of "priority".
    Therefore, the first menu selected will also be the default menu if there is no active menu on the current node.

    Attention!!!
    This is a breaking change.
    To be able to make this change, the format in which the selected menus were being saved in the block configuration changed, according to my tests, the only problem is having to configure the multiple menu blocks again.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Patch Failed to Apply
  • 🇵🇹Portugal lolgm

    Patch of changes described in #41

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Composer require failure
  • 🇵🇹Portugal lolgm

    Patch #42 is incomplete, this is the patch with changes #41.

  • 🇧🇪Belgium weseze

    Please don't make breaking changes that require manual work to fix... This is a hell when maintaining 100's of sites.
    Can't we instead create an update/post_update/deploy hook to fix things?

  • 🇵🇹Portugal lolgm

    I think I explained myself badly.

    The breaking change I mentioned is in relation to the previous patches in this issue, that is, the block MultipleMenuBlock (multiple_menu_block) which is under development and will be added in this issue.

    In this new patch that I suggested, the MultipleMenuBlock will undergo a change in its configuration, so if someone is going to test this new patch on the same instance that tested one of the previous ones, they will have to configure the block again to update its config.

    That said, I don't think an update hook is applicable here as it only concerns changes to the component under development.

  • 🇵🇹Portugal jrochate

    Doesn't work on latest 1.13

  • 🇵🇹Portugal lolgm

    Reroll #43 to 1.13.

  • 🇧🇪Belgium weseze

    patch 47 works fine for us. (it did need manually updating the block settings from previous patch...)

Production build 0.71.5 2024