Problem/Motivation

Because of the latest commit in https://www.drupal.org/project/taxonomy_menu/issues/3408881 I am not able to simply disable a menu link from UI, unless its related taxonomy term is unpublished. But I do not want to unpublish the term itself as I do have multiple taxonomy menus built on the same vocabulary, and some links have to be published under one menu but not the other.

Steps to reproduce

Proposed resolution

Traced the bug to that recent commit where in isActive() function we rely solely on taxonomy term status without taking into consideration the choice made on Menu Link UI (to disable/enable it).

Attaching a patch to modify the recent commit to only return the link status based on taxonomy term status as "inactive" if the term is unpublished. Otherwise, it should return the status selected for the link itself.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

veronicaseveryn created an issue. See original summary.

veronicaseveryn’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB
znerol’s picture

Version: 8.x-3.7 » 8.x-3.x-dev

This affects us as well.

znerol’s picture

The patch could be simplified a bit. The following one line change does the job as well:

-    if (!empty($link)) {
+    if (parent::isEnabled() && !empty($link)) {

Ultimately this is a question of coding style. I do not have any preference on how the issue is resolved.

mighty_webber’s picture

We are also experiencing this. The provided patch resolves the issue.

damienmckenna’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
Parent issue: » #3504923: Plan for Taxonomy Menu 8.x-3.8

I'm sorry that the other bug fix introduced this bug.

Let's expand the test coverage to make sure this doesn't come back to haunt us again.

jannakha’s picture

Priority: Normal » Critical

@veronicaseveryn thanks for patch!
+1 for patch #2

changing priority to critical

alexander tallqvist’s picture

Can confirm that the patch #2 fixed the issue for us as well.

znerol’s picture

Assigned: Unassigned » znerol
Priority: Critical » Normal

Working on tests.

znerol’s picture

Status: Needs work » Needs review

Pushed a test which passes with the fix and fails without.

znerol’s picture

Assigned: znerol » Unassigned
jannakha’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new30.12 KB
new19.34 KB

thanks for you contribution!
Tested MR16 - looks good.

Screenshot before patch:
before
Screenshot after patch:
after

trickfun’s picture

Patch works fine!
Thank you

savage1974’s picture

Patch works.
Thanks a lot!

Nuances:
1. The patch also allows you to change the menu structure (for example, items of level 2 display as items of level 1)
2. After adding a new item to the taxonomy and saving it, the menu structure doesn't change.

PS drupal 11.1.7 (drupal cms), module - Taxonomy Menu 8.x-3.7

chike’s picture

The patch works.

Thanks.

batigolix’s picture

Issue tags: +finalist-sprint

I also confirm that the changes introduced in the merge request solve the problem

vinodhini.e’s picture

Hi, Steps to reproduce

Installed the Taxonomy Menu module on Drupal 11.2.x.
Created a vocabulary and added terms.
Built a menu from the vocabulary.
Tried to disable a menu link from the Menu UI while keeping the related taxonomy term published.
Issue: The menu link could not be disabled unless the taxonomy term itself was unpublished.

After applying Merge Request #16
Able to disable the specific menu link directly from the Menu UI.
Functionality is working fine as expected. ✅

Thanks!

  • damienmckenna committed c7893bb4 on 8.x-3.x authored by znerol
    Issue #3505347 by veronicaseveryn, znerol, mighty_webber, damienmckenna...
damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

This has been committed, thanks everyone.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.