Currently, on the taxonomy term listing page (admin/structure/taxonomy/vocab_name), one can add new term by clicking on "Add term". I think we can change this to "Add new [vocabulary_name]" and passed through t() to allow flexibility, where [vocabulary_name] is replaced dynamically.

Though this can be achieved by writing a hook_menu_alter() but including this in the core seems to be fine.
This code works for me currently

<?php 

function my_fixes_menu_alter(&$items){
  $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/add']['title callback'] = 'current_vocab';
  $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/add']['title arguments'] = array(3);

}
	
function current_vocab($arg){
	$vocab_name = check_plain($arg->name);
	return t('Add new @vocab_name', array('@vocab_name' => $vocab_name));
}

Can this be ported to Drupal core taxonomy module?

Comments

adigunsherif created an issue. See original summary.

dpi’s picture

Status: Patch (to be ported) » Active

Incorrect status usage.

djalxs’s picture

I have implemented and tested said functionality, patch uploaded.

djalxs’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: change-add-term-to-add-[vocabulary-name]-2851657-3.patch, failed testing.

adigunsherif’s picture

Why did the patch fail testing?

djalxs’s picture

Status: Needs work » Needs review
StatusFileSize
new1007 bytes

I have tested the patch on my dev build again and it works without issue.

This is pure speculation, but I feel it could be to do with the filename. I have removed special characters from the filename to see if the patch validates & passes.

djalxs’s picture

So we must not be able to use special characters in patch filenames.

Aanal.addweb’s picture

Status: Needs review » Needs work
StatusFileSize
new11.35 KB

@djalxs,Thanks for the patch but still i face some issues which i mentioned in attachment.Please have a look & let me know if you have any query.

djalxs’s picture

Status: Needs work » Needs review

I'm unsure what the attachment is supposed to show with regards to this patch.

If you can give me some more information I will be more than willing to help you out however, one thing I will mentions is that, by the looks of the attachment you are running Drupal 8. This issue is for Drupal 7, therefore the patch is also for Drupal 7.

adigunsherif’s picture

I can see also that she's running Drupal 8. This issue is for Drupal 7.

...testing the patch right away

Aanal.addweb’s picture

Status: Needs review » Needs work
StatusFileSize
new19 KB

@djalxs & @adigunsherif , Sorry i've uploaded wrong image instead of the attached image.
i mentioned the needed changes in "New attachment" file.
please have look & let me know if i'm wrong.

adigunsherif’s picture

That's very correct. It should be replaced dynamically everywhere "add term" appears.

gg24’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new1.88 KB
new1.35 KB

I have updated the required changes, also added a interdiff. Please review.

Thanks!

gg24’s picture

Some minor changes in the above patch.

Thanks!

dhruveshdtripathi’s picture

Status: Needs review » Needs work
StatusFileSize
new26.72 KB
new36.68 KB

After applying patch #15, Add Term changed to Add new "[vocabulary_name]". I created News Taxonomy so it changed to Add new news. Great work @gg24

The changes are not applied on the main Taxonomy page.

gg24’s picture

Assigned: Unassigned » gg24
gg24’s picture

Status: Needs work » Needs review

Hi @dhruveshdtripathi

This issue has been created for "taxonomy term listing page (admin/structure/taxonomy/vocab_name)" only as mentioned in the issue description. If we really want to change it on Vocabulary listing page as well, lets create a new issue and open it for further discussion.

Thanks!

dhruveshdtripathi’s picture

Assigned: gg24 » Unassigned
Status: Needs review » Reviewed & tested by the community

OK then the last patch works fine. Changing status to RTBC.

David_Rothstein’s picture

Version: 7.54 » 8.4.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs backport to D7

Interesting idea - I'm not sure if people always name their vocabularies so that it would make perfect sense in this context, but overall I like it because it gives more information and makes things more consistent with other areas of Drupal (such as creating content).

It would need to go in Drupal 8 first though.

Also, for the code, make sure everything is properly translatable using placeholders (see https://www.drupal.org/docs/7/api/localization-api/dynamic-strings-with-...) rather than manual check_plain() calls.

I also don't understand the point of the strtolower() - that pattern is not used on the content creation page, right?

David_Rothstein’s picture

I'm not sure if people always name their vocabularies so that it would make perfect sense in this context

Another option (consistent with #2596207: More specific titles for term and vocabulary edit forms) would be to make it something like "Add term in the [vocabulary_name] vocabulary".

adigunsherif’s picture

I actually don't know of many other use cases. But in most of my use cases, it's better to have Add new [vocabulary_name]. Say for example, a vocab name "car". It makes more sense to have "Add new car" than "add term in car". Likewise "tag" => "Add new tag", and "category" => "Add new category".

And in the case of a School Management System built with Drupal where there are 3 academic terms in a session, it makes perfect sense to have "Add new session" instead of "Add term" which might be confusing to administrators who don't know about Drupal.

However, the [Add new] should be translatable t().

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.

joachim’s picture

Issue tags: +Needs usability review

> "Add new [vocabulary_name]"

That might not always make sense with the name of the vocab.

Also, there might be translation issues.

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.

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.

sumithb’s picture

The patch is given for Drupal 7. This is not implemented for Drupal 8?

aaronchristian’s picture

@sumithb, looks like the patch just needs to be re-rolled, however you can keep and eye on this one as it is similar and seems to be more active.

See https://www.drupal.org/project/drupal/issues/2596207#comment-12541541

berdir’s picture

As others pointed out, this is extremely hard to generalize and localize properly.

#2765065: Allow plurals on bundle labels is about allowing different versions of bundle labels, which might make this easier but not in any way easy. It's quite common to use plural labels for vocabularies right now, even Standard profile uses "Tags" and not "Tag".

Forced lowercase is a problem for german, other languages will have problems with order of words and so on.

Additionally, the term "term" is still everywhere, the empty text with the patch still has "No terms", there's the "List terms" operation, there's "Terms are grouped into vocabularies" and so on. It's not possible to "contextualize" them all properly, so honestly, I'd suggest to won't fix this.

Edit: This pattern also doesn't exist for nodes either, that has a single overview and "Add content", which then contains a list of available node types.

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.

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.

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.

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.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.