Problem/Motivation

As suggested in the comment https://www.drupal.org/node/2400543#comment-10461821 we need to improve the titles of the term and vocabulary pages. The titles should reflect on the edit as well as the delete page.

In particular, people editing a taxonomy term cannot see what vocabulary it is in. This is not good in its own right, and inconsistent with how editing content works, where you can see what content type it is.

Proposed resolution

  • Change the vocabulary edit page title from "Edit Vocabulary" to "Edit Vocabulary_Name"
  • Change the term edit page title from "Edit Term" to "Edit Term_Name in Vocabulary_Name"

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Screenshots

Before patch Edit of Vocabulary:

After patch Edit of Vocabulary:

Before patch Edit of Term:

After patch Edit of Term:

CommentFileSizeAuthor
#90 2596207-90.patch1.81 KBshashank5563
#78 Before patch #69.png63.01 KByashingole
#78 After Patch #69.png61.81 KByashingole
#74 drupal-vocabulary_form_titles-2596207-74.patch4.6 KBMirroar
#73 After_patch_pic.png66.69 KBvikashsoni
#73 Before_patch_pic.png62.33 KBvikashsoni
#70 interdiff_69-70.txt2.2 KBvsujeetkumar
#70 2596207-70.patch4.09 KBvsujeetkumar
#69 2596207-69.patch1.48 KBQusai Taha
#62 drupal-vocabulary_form_titles-2596207-62.patch4.79 KBckaotik
#55 2596207-55.patch4.96 KBjofitz
#51 vocabulary-in-breadcrumb.png112.97 KByoroy
#51 vocabulary-add-term.png114.98 KByoroy
#49 Edit vocab after patch .png39.34 KBDinesh18
#49 Edit term after patch.png59.03 KBDinesh18
#49 Edit vocabulary Before patch.png39.39 KBDinesh18
#49 Edit term Before patch.png57.58 KBDinesh18
#47 2596207-47.patch4.91 KBjofitz
#47 interdiff-46-47.txt1.37 KBjofitz
#46 drupal-2596207-46.patch4.92 KBgaurav.kapoor
#42 EditVocabulary.PNG12.81 KBTruptti
#42 Edit_taxonomy.PNG16.11 KBTruptti
#42 Edit_forum.PNG12.22 KBTruptti
#41 edit_forum_before.jpeg9.01 KBmtodor
#41 edit_forum_after.jpeg11.8 KBmtodor
#41 edit_vocabulary_before.jpeg14.51 KBmtodor
#41 edit_vocabulary_after.jpeg12.94 KBmtodor
#41 edit_term_before.jpeg7.36 KBmtodor
#41 edit_term_after.jpeg9.04 KBmtodor
#41 2596207_41.patch4.9 KBmtodor
#41 2596207_interdiff_41_34.txt889 bytesmtodor
#34 interdiff_2596207_34_32.txt1.06 KBmtodor
#34 2596207_34.patch4.68 KBmtodor
#32 interdiff-2596207-27-32.txt768 byteschr.fritsch
#32 term_vocaubulary_edit_form_title-2596207-32.patch4.36 KBchr.fritsch
#29 After-1.png38.56 KBkrina.addweb
#27 2596207-21-27.txt3.85 KBpixelmord
#27 term_vocaubulary_edit_form_title-2596207-27.patch5.01 KBpixelmord
#24 2596207-21.patch2.93 KBbovidiu
#20 2596207-20.patch2.44 KBSagar Ramgade
#20 interdiff-2596207-20.txt1.19 KBSagar Ramgade
#13 2596207-13.patch2.4 KBameymudras
#12 2596207-12.patch2.4 KBNitesh Pawar
#9 2596207-9.patch2.46 KBNitesh Pawar
#5 2596207-5.patch2.47 KBNitesh Pawar
#3 2596207-3.patch1.28 KBNitesh Pawar

Issue fork drupal-2596207

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Shreya Shetty created an issue. See original summary.

Nitesh Pawar’s picture

Assigned: Unassigned » Nitesh Pawar
Nitesh Pawar’s picture

Status: Active » Needs review
FileSize
1.28 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2596207-3.patch, failed testing.

Nitesh Pawar’s picture

Nitesh Pawar’s picture

Status: Needs work » Needs review

The last submitted patch, 3: 2596207-3.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: 2596207-5.patch, failed testing.

Nitesh Pawar’s picture

Status: Needs work » Needs review
FileSize
2.46 KB

Modified Test.

Nitesh Pawar’s picture

Priority: Normal » Minor
Nitesh Pawar’s picture

Assigned: Nitesh Pawar » Unassigned
Nitesh Pawar’s picture

Resolved the conflict happening for the forum & container add page.

ameymudras’s picture

Nitesh Pawar’s picture

Title: The edit/delete forms of term and vocabulary need better titles » The edit forms of term and vocabulary need better titles
Shreya Shetty’s picture

Status: Needs review » Reviewed & tested by the community

Its working good. Looks like RTBC to me

Nitesh Pawar’s picture

Issue tags: +rc target triage
xjm’s picture

Version: 8.0.x-dev » 8.1.x-dev
Category: Bug report » Task
Priority: Minor » Normal
Status: Reviewed & tested by the community » Postponed
Issue tags: -rc target triage +minor version target, +Usability

Thanks for the patch! This change would be a good improvement for usability.

This change would break strings, so we cannot make it any more during RC. We could improve this in a minor version, though. Reference: https://www.drupal.org/core/d8-allowed-changes

+++ b/core/modules/taxonomy/src/TermForm.php
@@ -20,6 +20,10 @@ class TermForm extends ContentEntityForm {
+      $form['#title'] = $this->t('Edit ' . $term->label());

+++ b/core/modules/taxonomy/src/VocabularyForm.php
@@ -54,7 +54,7 @@ public function form(array $form, FormStateInterface $form_state) {
+      $form['#title'] = $this->t('Edit ' . $vocabulary->label());

These are not correct uses of t(). Variables should always be added to the string using string placeholders for security and to allow them to be translated properly with context. See the documentation of the method for details.

Edit: Note that I've postponed the issue for now since 8.1.x is not open for development yet. Once it is, we can create an updated patch that improves the use of t().

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

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now 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-interfacetext
Sagar Ramgade’s picture

Patch updated with correct usage of t().

Sagar Ramgade’s picture

Status: Postponed » Needs review

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

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now 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.

pixelmord’s picture

I think this is very much needed but I would suggest to also include the vocabulary name since they are very closely tied together and you have to get the context of which vocabulary that term belongs to. Like so:

Edit term "Apple" in "Fruits" vocabulary

See the related issue for dealing with the breadcrumbs #1905370: Add missing vocabulary to fix term edit form breadcrumbs

bovidiu’s picture

On the recommendation of #23 i've added : Edit term "Apple" in "Fruits" vocabulary

Status: Needs review » Needs work

The last submitted patch, 24: 2596207-21.patch, failed testing.

pixelmord’s picture

Issue tags: +dcmuc16
+++ b/core/modules/taxonomy/src/TermForm.php
@@ -15,6 +15,11 @@ class TermForm extends ContentEntityForm {
+      $form['#title'] = $this->t('Edit @name in @parent vocabulary', array('@name' =>  $term->label(),'@parent' => $term->bundle()));

I think since we're stating the type for the vocabulary name, we should also do this for the term: e.g. Edit term XXXX in YYYY vocabulary. And to mark the names a little better I would suggest to wrap the part of the text that is about the operation in s like we do that for the Node form.

So we would have:
Edit term XXXX in YYYY vocabulary
<em>Edit term</em> XXXX <em> in YYYY vocabulary</em>

+++ b/core/modules/taxonomy/src/TermForm.php
@@ -15,6 +15,11 @@ class TermForm extends ContentEntityForm {
+      $form['#title'] = $this->t('Edit @name in @parent vocabulary', array('@name' =>  $term->label(),'@parent' => $term->bundle()));

$term->bundle() will not give you the name of the vocabulary, but the machine name

I will provide a new patch for that

pixelmord’s picture

Here's an updated patch, I addressed the issues mentioned in #26 and added tests

pixelmord’s picture

Status: Needs work » Needs review

Forgot to set the status ...

krina.addweb’s picture

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

@pixelmord Thanks! For your patch,It works for me same as #26.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: term_vocaubulary_edit_form_title-2596207-27.patch, failed testing.

The last submitted patch, 27: term_vocaubulary_edit_form_title-2596207-27.patch, failed testing.

chr.fritsch’s picture

Fixed the last failing test

Status: Needs review » Needs work

The last submitted patch, 32: term_vocaubulary_edit_form_title-2596207-32.patch, failed testing.

mtodor’s picture

Status: Needs work » Needs review
FileSize
4.68 KB
1.06 KB

Problem with test is randomization of name for Forum, that makes order of forums different randomly -> once "General discussion" is first in list, once new created forum is in front. So I made small quick solution, that first letter starts with 'f' (forum) and then it will always be in front of "General discussion".

Let's see will that work on TestBot.

chr.fritsch’s picture

Status: Needs review » Reviewed & tested by the community

Ok, lets go back to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 34: 2596207_34.patch, failed testing.

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

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.

chr.fritsch’s picture

Status: Needs work » Needs review

Patch, should still apply. Lets test

chr.fritsch’s picture

Status: Needs review » Reviewed & tested by the community

This is still green. Retested #34

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs screenshots

Can we get before/after screenshots here? Also specifically of the Forum taxonomy forms changed as a consequence of the patch. The test changes needed to make Forum work with this patch are kinda suspicious and make me wonder if we need to add a different actual fix for Forum.

Even if we do use the current change for forum, we should probably not use the random name at all and just use an intentional test value.

mtodor’s picture

I have changed testing a bit. Instead of changing random name, I have changed weight, so that new created forum is first in list. Changing randomization of name is another topic and it's not related with this issue. I personally prefer fixed names (so that tests do not flip-flop), but other developers prefer that tests discover problems.

I have attached screenshots. I have added for term and vocabulary in summary and here are forum related ones.

Before patch Edit of Forum:

After patch Edit of Forum:

Truptti’s picture

FileSize
12.22 KB
16.11 KB
12.81 KB

Verified the patch '2596207_41.patch' in #41 on Drupal 8.4.x.The observations are as follows:
1.The patch got applied without any errors
2.The title for Edit Vocabulary is changed to 'Edit Vocabulary-name' eg . Edit Category
3.The title for Edit Vocabulary term is changed to Edit name in Vocabularyname vocabulary' eg. Edit test in Category vocabulary'
4.The title for Edit Forum is changed to 'Edit name in Forums vocabulary' eg 'Edit test in Forums vocabulary'
Attaching snapshot for reference
This can be marked as RTBC.

Truptti’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 41: 2596207_41.patch, failed testing.

gaurav.kapoor’s picture

Assigned: Unassigned » gaurav.kapoor
gaurav.kapoor’s picture

Assigned: gaurav.kapoor » Unassigned
Status: Needs work » Needs review
FileSize
4.92 KB

Re-roll.

jofitz’s picture

Correct coding standards issues - "Short array syntax must be used to define arrays"

David_Rothstein’s picture

Linking to a similar issue, but for adding terms rather than editing them.

Dinesh18’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
57.58 KB
39.39 KB
59.03 KB
39.34 KB

Hello,

I have applied the patch mentioned in comment #47 (2596207-47.patch). It is working as expected. PFA screenshots.

lauriii’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs usability review
yoroy’s picture

Adding

I feel with adding the vocabulary name to the title when editing a term we might be overdoing it a bit. I don't think we should use the title to express hierarchy or relationship.

Is it at all possible to show the vocabulary name in the breadcrumb instead?

Because that is what happens when creating a new term:

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

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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: The edit forms of term and vocabulary need better titles » More specific titles forterm and vocabulary edit forms
Status: Needs review » Needs work

Needs a reroll.

jofitz’s picture

Status: Needs work » Needs review
FileSize
4.96 KB

Re-roll.

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

joachim’s picture

Status: Needs review » Needs work

This isn't quite right.

Looking at nodes, the content entity, the node, has:

> /Edit Article/ Title

(i.e., all EM except the entity label)

The config entity, the node type, though has:

> Edit /Article/ content type

(i.e., only the entity label is in italic.)

Is that correct? That seems odd to me, but maybe there is a UX reason.

So either:

1. we follow suit, and the vocab edit page shoud be like the content type edit page
2. we file / look for an issue to see whether the italic discrepancy is indeed a discrepancy

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ckaotik’s picture

The patch in #55 needs a reroll, as it causes a whitepage on systems with Drupal 8.7+. The Vocabulary class was moved (or removed), so Vocabulary::load fails. Possible replacement: $vocabulary = $term->vid->entity;

joachim’s picture

> The Vocabulary class was moved (or removed), so

I don't think that's the case:

8.7:

src/Entity/Vocabulary.php

8.8:

src/Entity/Vocabulary.php

Entity::load() still exists, so I don't know why that would cause a problem.

At any rate though, Entity::load() is not recommended, so $term->vid->entity is a good replacement just stylistically.

ckaotik’s picture

The Vocabulary class was moved (or removed)

That's indeed incorrect, my bad. I suspect our issue was actually that the patch didn't apply cleanly (possibly due to other patches), so we were missing the added use Drupal\taxonomy\Entity\Vocabulary; statement which in turn caused a whitepage:

Error: Class 'Drupal\taxonomy\Vocabulary' not found in Drupal\taxonomy\TermForm->form() (Zeile 23 in /srv/www/htdocs/my-site.url/html/core/modules/taxonomy/src/TermForm.php)

ckaotik’s picture

Title: More specific titles forterm and vocabulary edit forms » More specific titles for term and vocabulary edit forms
Status: Needs work » Needs review
FileSize
4.79 KB

I've ported the patch for moved test files. I've also changed the title text slightly, to reduce the amount of emphasized text to <em>Edit</em> @name in %parent vocabulary (old: <em>Edit</em> @name <em>in @parent vocabulary</em>).
I didn't get the overridden titles on term forms, though that might be because of other modules. Let's see how the tests fare.

Status: Needs review » Needs work

The last submitted patch, 62: drupal-vocabulary_form_titles-2596207-62.patch, failed testing. View results

ckaotik’s picture

> I didn't get the overridden titles on term forms, though that might be because of other modules. Let's see how the tests fare.

Well, guess it wasn't just my setup then. But I wonder, why does the $form['#title'] not stick? The route's title would be "Edit term", but what's displayed is simply "My term name".

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Qusai Taha’s picture

I edited the patch 62 to perform the following:
1 - When adding a new term (Add term) => Add "vocabulary_name".
2 - When Editing term (Edit term)=> Edit (term_name).
3 - When Editing vocabulary (Edit vocabulary) => Edit (vocabulary_name).

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
4.09 KB
2.2 KB

@qusai taha I think you missed some tests changes as per #62, I have added those and fixed fail tests, Please have a look.

Status: Needs review » Needs work

The last submitted patch, 70: 2596207-70.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
vikashsoni’s picture

FileSize
62.33 KB
66.69 KB

Appiled patch #69 working fine now title added when edit vocublary for ref sharing screenshot ...

Mirroar’s picture

I've rerolled the patch from #70 against 9.3.x and added a test for the title change when adding taxonomy terms.

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

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.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.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now 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.

yashingole’s picture

Assigned: Unassigned » yashingole
yashingole’s picture

Assigned: yashingole » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
61.81 KB
63.01 KB

Verified and tested patch #69 on Drupal 9.5.x-dev. Patch applied successfully and looks good to me.
Testing steps:
1. Install 9.5
2. Visit /admin/structure/taxonomy/add
3. Add a new vocabulary.
4. Edit vocabulary.
5. Observe the "Edit Vocabulary" heading.
6. Apply patch #69
7. Observe the heading "Edit "
Testing Result:
1. After applying the patch heading of the edit page has changed. Screenshots are attached for reference:
Can be move to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 74: drupal-vocabulary_form_titles-2596207-74.patch, failed testing. View results

quietone’s picture

Thanks everyone for working on this issue. Remember to read the comments before rerolling a patch. Comment #57 has not been addressed. Setting NW for discussing and consider #57.

The screenshots in the Issue Summary are to be from the latest patch. The Issue Summary also has states that this is not making User Interface changes and it is. That needs to be corrected. The Issue Summary needs to be updated. I am adding the tag for that.

I also don't see a code review here. That needs to be done as well.

@yashingole, thanks for listing what you did to test the patch.

Having a working patch is not usually sufficient to mark an issue RTBC. There are several steps, or Review a patch or merge request task of the Contributor guide is sufficient. The complete list of core gates has more topics. Also, check the tags on the issue and make sure they are complete.

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

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now 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.

smustgrave’s picture

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Status: Needs work » Needs review

Please review.

smustgrave’s picture

Status: Needs review » Needs work

Still needs an issue summary update

And not sure why this needs to change the forum test? Want to make sure we aren't just editing the tests to pass.

sakthi_dev’s picture

Hi @smustgrave. Forum module is linked with Taxonomy as the Forum container are getting added in taxonomy term and uses term and vocabulary forms. So the test of Forum module checks the title of vocabulary and term forms. Hope it is clear to you now. Thanks!

shashank5563’s picture

For the Vocabulary edit form title to apply this patch.

Version: 10.1.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, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jannakha’s picture

patch #90 is not valid

mlncn’s picture

Issue summary: View changes
Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -Needs issue summary update

If 3883 is the MR to be used it should be updated for 11.x and all patches hidden for clarity. Not familiar enough with the issue to make that call.

vsujeetkumar’s picture

I have updated the MR for 11.x. Please have a look.

vbouchet’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Left some feedback.

sakthi_dev’s picture

Updated the test for the new term addition as per comment #98.

sakthi_dev’s picture

Status: Needs work » Needs review

Changing status to Needs Review as the test case is added and to get the clarity.

smustgrave’s picture

Status: Needs review » Needs work

Addressed comment, also seems to have some test failures.

sakthi_dev’s picture

Thanks @smustgrave, added typehint for return type.