No options for view menu items

Created on 27 November 2022, almost 2 years ago
Updated 19 September 2024, 2 months ago

Problem/Motivation

Menu items created with Views do not display the options for Menu Link Attributes.

Steps to reproduce

Create a view and assign a menu item. Now look at the Menu item and you will not see the options you do for regular menu items.

✨ Feature request
Status

Needs work

Version

1.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States joshuautley

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.

  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    This is the case for any module-provided, any code/config provided menu item, as opposed to menu links (content).

    This does need to be better documented on the user page.

    And of course it would be great if we could add attributes to these machine-provided menu items.

    A workaround is to create a custom menu link through the interface that links to your view, but is not itself provided by the view.

  • Igor Mashevskyi β†’ made their first commit to this issue’s fork.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work about 1 year ago
  • πŸ‡§πŸ‡ͺBelgium rgeerolf Belgium πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    I tried the MR against 1.3 and the latest dev and I got an error when I tried to edit the menu link.

    TypeError: _menu_link_attributes_add_attributes(): Argument #2 ($menu_link_options) must be of type array, null given, called in /var/www/html/web/modules/contrib/menu_link_attributes/src/Plugin/Menu/Form/ViewsMenuLinkWithAttrForm.php on line 19 in _menu_link_attributes_add_attributes() (line 46 of modules/contrib/menu_link_attributes/menu_link_attributes.module).

  • 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
  • Status changed to Needs review 8 months ago
  • Status changed to Needs work 6 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Merge error

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @Igor Mashevskyi any plans to finish this?

  • Pipeline finished with Success
    2 months ago
    Total: 187s
    #286312
  • Status changed to Needs review 2 months ago
  • @anybody I've resolved the merge error, so MR is mergeable now

  • Status changed to Needs work 2 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks @Igor Mashevskyi I left a few comments. Nice work.

    Maybe @mlncn wants to have a look afterwards, what he thinks?

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    It works great!

    With one strange caveatβ€” the attributes collapsed fieldset is also shown when editing the menu item from the view, which is great, but while it showed my class and target that i had set when editing the menu link through the Menu UI, it did not show the container_class that i had set (which, to be fair, never worked as intended, showing on the link itself as container_class not the item surrounding it) and saving the menu link from the view resulting in stripping that container_class out. Minor, but worth opening an immediate bug report after this feature goes in if it cannot be solved right away.

    Note that Igor Mashevskyi's patch does this for views-provided menu links; it does not provide attributes for other system-provided menu links, or at least not for the user account / login links.

    Thank you for this!

Production build 0.71.5 2024