From 8c5fad98083030a518451e6fa1748c33382c63b4 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 9 Apr 2024 09:19:46 +0100 Subject: [PATCH] Issue #2822890 by danflanagan8, Peacog, Lendude, quietone, smustgrave, AaronMcHale, benjifisher: Taxonomy vocabulary translation local task tab not shown in UI --- .../Functional/ConfigTranslationListUiTest.php | 5 +++++ core/modules/taxonomy/taxonomy.module | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php index 29d11d89fdf5..0cb1ede702e8 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php @@ -192,6 +192,11 @@ class ConfigTranslationListUiTest extends BrowserTestBase { // Test if the link to translate actually goes to the translate page. $this->drupalGet($translate_link); $this->assertSession()->responseContains('Language'); + + // Test if the local task for translation is on this page. + $this->assertSession()->linkExists('Translate taxonomy vocabulary'); + $local_task_url = parse_url($this->getSession()->getPage()->findLink('Translate taxonomy vocabulary')->getAttribute('href')); + $this->assertSame(base_path() . $translate_link, $local_task_url['path']); } /** diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index b2297302aa01..e2e3ac143c13 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -73,6 +73,21 @@ function taxonomy_theme_suggestions_taxonomy_term(array $variables) { return $suggestions; } +/** + * Implements hook_local_tasks_alter(). + * + * @todo Evaluate removing as part of https://www.drupal.org/node/2358923. + */ +function taxonomy_local_tasks_alter(&$local_tasks) { + $local_task_key = 'config_translation.local_tasks:entity.taxonomy_vocabulary.config_translation_overview'; + if (isset($local_tasks[$local_task_key])) { + // The config_translation module expects the base route to be + // entity.taxonomy_vocabulary.edit_form like it is for other configuration + // entities. Taxonomy uses the overview_form as the base route. + $local_tasks[$local_task_key]['base_route'] = 'entity.taxonomy_vocabulary.overview_form'; + } +} + /** * Prepares variables for taxonomy term templates. *