Problem/Motivation

In large sites with thousands of terms across different vocabularies it is not possible to know which vocabulary the terms belong to when editing it.

I have a situation where the term 'apple' appears in two different vocabularies ending up with one URL for /apple and another for /apple-0.
Then I visit the two term pages and click edit. At this point, there is no information regarding which vocabulary that term belongs to.

Proposed resolution

Display the vocabulary name in the breadcrumb when editing a term. Optionally also align the breadcrumb of the Add term form with the Edit term form.

Remaining tasks

User interface changes

Breadcrumb of the Edit term includes the link to the vocabulary.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcelovani’s picture

Status: Active » Needs review
FileSize
38.8 KB

I have created a patch, see screenshot
If it gets applied to core, I will do the same for 8.x

marcingy’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Active

Features get added to latest version first and needs review indicates a patch exists.

Ravi.J’s picture

This is a very useful feature to have. I have had similar problems in the past.
From the screenshot Breadcumb should also say Home >> Fruits >> Banana

marcelovani’s picture

I forgot to attach the patch, will do for 8.x first then 7.x, cheers

marcelovani’s picture

Status: Active » Needs review
FileSize
25.05 KB
1.45 KB

Adding patch for 8.x, which includes the change on breadcrumb (see screenshot)

marcelovani’s picture

marcingy’s picture

Status: Needs review » Needs work
@@ -34,7 +34,7 @@
 /**
  * Minimum supported version of PHP.
  */
-const DRUPAL_MINIMUM_PHP = '5.3.5';
+const DRUPAL_MINIMUM_PHP = '5.3.3';

Why is the minimum php version being changed in this patch?

'#markup' => '<b>' . t('Vocabulary') . ':</b>&nbsp;' . l(t($vocabulary->name), 'admin/structure/taxonomy/' . $vocabulary->id()),

Variables should not go through t(). Similar issues in the breadcrumb code.

marcelovani’s picture

Oops, the PHP version was a debugging thing, should not have gone to the patch, will fix it.

marcelovani’s picture

Status: Needs work » Needs review
FileSize
1.08 KB

Status: Needs review » Needs work

The last submitted patch, show_vocabulary-1905370-9.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review

#9: show_vocabulary-1905370-9.patch queued for re-testing.

blairski’s picture

Looks good and a very handy feature. Shouldn't <strong> be used instead of <b> in #markup?

marcelovani’s picture

@Blairski I have changed <b> to <strong>

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me

webchick’s picture

Category: feature » task
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

This looks like a useful UX enhancement. I'm re-categorizing as a task rather than a feature though, because it's pretty straight-forward.

However, we need automated tests that show the functionality works as expected. See http://drupal.org/simpletest or drop by core mentoring hours if you need a hand!

PawelR’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.95 KB

Re rolled patch with test included.

noels’s picture

Status: Needs review » Reviewed & tested by the community

I ran all TAXONOMY TERM FUNCTIONS AND FORMS tests which pass.

marcingy’s picture

Status: Reviewed & tested by the community » Needs work
$this->assertLink(t('Add term'),0,'Vocabulary link works.');

Does not meet drupal coding standards also no need for a message to be supplied just let the assert return the default message.

PawelR’s picture

Status: Needs work » Needs review
FileSize
1.93 KB

patch without a message

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

marcelovani’s picture

Status: Reviewed & tested by the community » Needs work

When applying the patch I had these errors

git apply ../show_vocabulary-1905370-19.patch
../show_vocabulary-1905370-19.patch:18: trailing whitespace.
}
../show_vocabulary-1905370-19.patch:19: trailing whitespace.

../show_vocabulary-1905370-19.patch:34: trailing whitespace.

marcelovani’s picture

Status: Needs work » Needs review
FileSize
1.91 KB

I am not sure that the test in #19 is actually checking the purpose of this issue.

It is checking for a link 'Add term' when editing a vocabulary where it should check for a link to the vocabulary when editing a term.

I have added the relevant test, please review.

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

It works because it is clicking the link and ensuring a page is loaded with the link

$this->clickLink($this->vocabulary->name);

Your test works equally as well as it is checking for the presence of the link and not following it. Either version works assuming this comes back green it is RTBC. And nice catch on the white space I missed those before when doing an eyeball review :)

PawelR’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.91 KB

Please correct me if I'm wrong but is it not better to test if link is actually working and it's not broken (by going to vocabulary page and testing content there) than just simply test presence of the link on term page?

marcelovani’s picture

The patch on #19, #24 does the following:

Goes to the vocabulary page. i.e. /admin/structure/taxonomy/fruits
$this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id());

Clicking on the link to the vocabulary will keep you on the same page as the link is on the LIST tab
$this->clickLink($this->vocabulary->name);

Checks that there is a link to 'Add term' on the vocabulary page
$this->assertLink(t('Add term'));

// Go back to term page. In fact you go back to Vocabulary edit
$this->clickLink(t('edit'));

Please review this, there is no test for the actual issue's purpose, which is to test the link to the Vocabulary when editing a Term
i.e.
If you have a vocabulary called 'fruits', and fruits has a term called 'banana'.
When you are on taxonomy/term/2/edit you will have a breadcrumb: Home > Fruits > Banana
The test needs to check that there is a link to Fruits

Please correct me if #22 doesn't do that

noels’s picture

I prefer the patch in #24. It does what #22 does, but it also tests the link is working.

You say:
Clicking on the link to the vocabulary will keep you on the same page as the link is on the LIST tab
$this->clickLink($this->vocabulary->name);

I see the link on the EDIT page. Clicking the link takes you to the term list. The test in #24 should be adopted.

Status: Needs review » Needs work

The last submitted patch, show_vocabulary-1905370-24.patch, failed testing.

PawelR’s picture

Status: Needs work » Needs review

#24: show_vocabulary-1905370-24.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, show_vocabulary-1905370-24.patch, failed testing.

PawelR’s picture

Status: Needs work » Needs review
FileSize
1.91 KB

re-rolled patch #24

dudycz’s picture

Status: Needs review » Reviewed & tested by the community

I also think that test in #30 is better, it definitely checks the link on term page.

marcelovani’s picture

Cool

marcelovani’s picture

How can we get this committed? I have the patch for D7 ready and we need this functionality on our D7 sites as soon as possible.

xjm’s picture

#30: show_vocabulary-1905370-30.patch queued for re-testing.

xjm’s picture

Issue tags: +Quick fix

Okay, it won't let me embed the screenshots for some reason, but they're in #0 (before) and #1 (after).

webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Usability

You know...

Looking at this again after some time away, I'm wondering if we want to do exactly this. It seems to introduce inconsistency with what we do at e.g. menu links, which are also hierarchical. There, the method of informing you what menu you're editing is merely by changing the breadcrumb to include it: Home >> Administration >> Structure >> Menus >> Main navigation

I'm actually thinking it would be better if we were just to do that much of the patch, and not also the part of entering a new form element above Name, which is generally the very first element in a form, so it's a bit odd for it not to be here.

Tagging for the UX team to chime in.

marcelovani’s picture

FileSize
43.62 KB
43.64 KB
1.87 KB

I agree with the comment about inconsistency in coding. Please review now.
Regarding displaying the additional element, I think you are right, and on the top of that we don't need to have the same information twice.

marcelovani’s picture

Issue summary: View changes
FileSize
2.24 KB

Re-rolled the patch for 8.x

Status: Needs review » Needs work

The last submitted patch, 38: show_vocabulary-1905370-38.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
marcelovani’s picture

Status: Needs review » Needs work

The last submitted patch, 38: show_vocabulary-1905370-38.patch, failed testing.

Gábor Hojtsy’s picture

The changes look good, but one of the sets of fails is this which looks suspiciously related:

    // Edit the term.
    $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
    $this->assertResponse(200);
    $this->assertText($edit['name'], 'Edit taxonomy term form opened successfully.');

It is pretty clearly related to the taxonomy term edit page, which looks to return a 200 response but not have the term there? This may be due to prior tests finding it in the breacrumb (instead of the form?). If you run the test locally, you will get debug page output for these fails so you can check what is going on there.

marcelovani’s picture

Status: Needs work » Needs review
FileSize
2.37 KB

Ok lets try again

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Great, so you added the link to the term, so now it works again :) Looks good to me. This should improve the velocity of taxonomy administration a lot.

marcelovani’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
3.4 KB

I found a problem where terms with parents didn't display the breadcrumb properly.
I have added a test to make sure breadcrumb shows home >> vocabulary >> parent term >> term.

$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$this->clickLink($term->label());
$this->clickLink(t('Edit'));
$this->assertLink($this->vocabulary->name);
$this->assertLink($parent->label());
$this->assertLink($term->label());
marcelovani’s picture

Status: Needs review » Needs work

The last submitted patch, 46: show_vocabulary-1905370-46.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
FileSize
3.39 KB

Re-rolled the patch

znerol’s picture

This is a very useful addition, indeed. The patch applies and the breadcrumb works like a charm on the term edit page. However when adding a term, the breadcrumb is different. For example when clicking the vocabulary name, I end up on the vocabulary edit page.

It would be great when the term-edit and the term-add breadcrumbs would work the same way.

taxonomy term add breadcrumb leads to the vocabulary edit page

marcelovani’s picture

Hi znerol,

I see what you mean. Please note that the urls are also different.

Drupal by default has the following:
The page /taxonomy/term/1/edit has breadcrumb Home > t1
The page /admin/structure/taxonomy/manage/tags/add has breadcrumb Home > Administration > Structure > Taxonomy

If you want to propose these changes, perhaps it should part of a separate issue.

marcelovani’s picture

Issue tags: +drupaldevdays

Is it possible to squeeze this issue in?

znerol’s picture

Status: Needs review » Needs work
Issue tags: -drupaldevdays

Needs a reroll after #2292025: Convert BreadcrumbBuilderInterface applies() and build() to use RouteMatch.

@marcelovani: Is there any technical reasons against #50?

marcelovani’s picture

Not really. My only concern was that proposing a change in the API would incur extra debating and delay the acceptance of the patch.
But now they have changed the whole codebase in a way that the patch no longer applies anyway.
That said, we could either create a new issue and link to this one or change the topic of this issue and propose the changes you mentioned.

znerol’s picture

I'm willing to continue reviewing / RTBC this. I leave the decision whether or not to include #50 to the person working on this patch and to the person who eventually will commit it. The patch already has been rejected once because of consistency reasons (see #36), therefore I think it would be smart to at least give it a try. If it is easy then do it, if not then let's open a follow-up.

Modifying the breadcrumb is not considered an API change, so no need to fear rejection because of that. The issue summary needs an update anyway to reflect #37.

I am not 100% sure whether this patch can be included in 8.0.x based on Beta changes policy. I think it should be possible because it was RTBC several times way before the beta deadline.

marcelovani’s picture

I agree with all you said.
The thing is, I have spend too much time with this issue, which is rather simple.
But unfortunately it has taken so much time that I can no longer spend any time on this, as I am busy with other work.
If anyone is interested in continuing with it, please feel welcome.

znerol’s picture

Issue summary: View changes
Shreya Shetty’s picture

I guess the issue which marcelovani is talking in #51 has a patch already .That can be found on https://www.drupal.org/node/2400543

jibran’s picture

Issue tags: +Needs reroll

From #50

This is a very useful addition, indeed. The patch applies and the breadcrumb works like a charm on the term edit page. However when adding a term, the breadcrumb is different. For example when clicking the vocabulary name, I end up on the vocabulary edit page.

This issue will be irrelevant once #1340500: Merge "list terms" page into "edit vocabulary" page is fixed.

jibran’s picture

siva_epari’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
2.06 KB
3.52 KB

Changes of TermBreadcrumbBuilder.php moved to PSR-4 file location(Check interdiff).

Patch rerolled.

Status: Needs review » Needs work

The last submitted patch, 61: show_vocabulary-1905370-61.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

yoroy’s picture

Issue tags: +ux-workflow

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

yoroy’s picture

FileSize
25.05 KB

Could the link to the vocabulary be shown in the description of the field? More compact and closer to the term field itself:

(The other arrow is for pointing out that yes, the breadcrumb needs fixing too)

pixelmord’s picture

Regarding #66 I think it is a good idea to put some explanatory text somewhere, but the text underneath the field is by default reserved for the field's description/help text and that is totally up to the site-builder to set that.
I would suggest that it could very well done also in this issue: #2596207: More specific titles for term and vocabulary edit forms where we could set the title lieke so:

Edit term "Apple" in "Fruits" vocabulary

Then it would be not so bad that someone could override/change the description

pixelmord’s picture

Issue tags: +dcmuc16

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

David_Rothstein’s picture

Sounds like it's necessary to choose between this issue and #2596207: More specific titles for term and vocabulary edit forms? It is hard to imagine doing both of them.

David_Rothstein’s picture

Issue tags: +Needs backport to D7

Well, I take that back - to the extent this issue is about fixing the confusing breadcrumbs, it makes sense to do no matter what. But in that case it should probably be retitled.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Pancho’s picture

Title: Display which vocabulary the taxonomy belongs when editing a term » Add missing vocabulary to fix term edit form breadcrumbs

Per #71

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.