From fc2ff4dcdb8efebb481a7afb8ed5448a9291de38 Mon Sep 17 00:00:00 2001 From: Daniel Speicher <daniel.speicher@lakedrops.com> Date: Fri, 22 Nov 2024 11:00:39 +0100 Subject: [PATCH] git commit -m 'Issue #3352586: Parameter to disable machine name in terms overview' --- patches/d10-3.json | 2 +- patches/d10-4.json | 2 +- patches/d10.json | 2 +- patches/d10/33525862-2.diff | 165 ++++++++++++++++++++++++++++++++++++ patches/d11.json | 2 +- 5 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 patches/d10/33525862-2.diff diff --git a/patches/d10-3.json b/patches/d10-3.json index 6364ffa..e140076 100644 --- a/patches/d10-3.json +++ b/patches/d10-3.json @@ -209,7 +209,7 @@ "drupal/taxonomy_machine_name": { "#3193233 Filter doesn't work": "https://www.drupal.org/files/issues/2021-01-17/taxonomy_machine_name-view-save-error-3193233.patch", "#3128397 View can not be saved": "https://www.drupal.org/files/issues/2020-04-16/config_schema-3128397-3.patch", - "#3352586 Parameter to disable machine name in terms overview ": "https://git.drupalcode.org/project/taxonomy_machine_name/-/merge_requests/8.diff" + "#3352586 Parameter to disable machine name in terms overview ": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/33525862-2.diff" }, "drupal/taxonomy_manager": { "#3474919 Form element taxonomy_manager_tree broken": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3474919.diff" diff --git a/patches/d10-4.json b/patches/d10-4.json index aea767c..2320c24 100644 --- a/patches/d10-4.json +++ b/patches/d10-4.json @@ -209,7 +209,7 @@ "drupal/taxonomy_machine_name": { "#3193233 Filter doesn't work": "https://www.drupal.org/files/issues/2021-01-17/taxonomy_machine_name-view-save-error-3193233.patch", "#3128397 View can not be saved": "https://www.drupal.org/files/issues/2020-04-16/config_schema-3128397-3.patch", - "#3352586 Parameter to disable machine name in terms overview ": "https://git.drupalcode.org/project/taxonomy_machine_name/-/merge_requests/8.diff" + "#3352586 Parameter to disable machine name in terms overview ": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3352586-2.diff" }, "drupal/taxonomy_manager": { "#3474919 Form element taxonomy_manager_tree broken": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3474919.diff" diff --git a/patches/d10.json b/patches/d10.json index 86e3f8b..5396e50 100644 --- a/patches/d10.json +++ b/patches/d10.json @@ -195,7 +195,7 @@ "drupal/taxonomy_machine_name": { "#3193233 Filter doesn't work": "https://www.drupal.org/files/issues/2021-01-17/taxonomy_machine_name-view-save-error-3193233.patch", "#3128397 View can not be saved": "https://www.drupal.org/files/issues/2020-04-16/config_schema-3128397-3.patch", - "#3352586 Parameter to disable machine name in terms overview ": "https://git.drupalcode.org/project/taxonomy_machine_name/-/merge_requests/8.diff" + "#3352586 Parameter to disable machine name in terms overview ": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3352586-2.diff" }, "drupal/title": { "#3172331 D9 compatibility": "https://www.drupal.org/files/issues/2021-08-24/D9-compatibility_3172331.patch" diff --git a/patches/d10/33525862-2.diff b/patches/d10/33525862-2.diff new file mode 100644 index 0000000..f1d0928 --- /dev/null +++ b/patches/d10/33525862-2.diff @@ -0,0 +1,165 @@ +diff --git a/composer.json b/composer.json +index 41b19f5fe9afe25dabdac641c11baaa94f2ba8ab..bda38d5015851179c99ece6f46a67312a36ccae2 100755 +--- a/composer.json ++++ b/composer.json +@@ -24,6 +24,6 @@ + "source": "https://git.drupalcode.org/project/taxonomy_machine_name" + }, + "require": { +- "drupal/core": "^9.4 || ^10" ++ "drupal/core": "^9.4 || ^10 || ^11" + } + } +diff --git a/config/install/taxonomy_machine_name.settings.yml b/config/install/taxonomy_machine_name.settings.yml +new file mode 100644 +index 0000000000000000000000000000000000000000..4593ad4f74557433d1b3a98bed866d0917c3a142 +--- /dev/null ++++ b/config/install/taxonomy_machine_name.settings.yml +@@ -0,0 +1 @@ ++hide_machine_name_in_terms_overview: 0 +diff --git a/modules/search_api_taxonomy_machine_name/search_api_taxonomy_machine_name.info.yml b/modules/search_api_taxonomy_machine_name/search_api_taxonomy_machine_name.info.yml +index c30e70172377b0de1c213087f6e4e73ae02b2c95..a67abac92a6f11288cb3d78addf68d6e07963d22 100644 +--- a/modules/search_api_taxonomy_machine_name/search_api_taxonomy_machine_name.info.yml ++++ b/modules/search_api_taxonomy_machine_name/search_api_taxonomy_machine_name.info.yml +@@ -2,8 +2,7 @@ name: Search API Taxonomy Machine Name + description: Search API integration for the Taxonomy Machine Name module + type: module + package: Other +-core: 8.x +-core_version_requirement: ^8 || ^9 || ^10 ++core_version_requirement: ^10 || ^11 + + dependencies: + - taxonomy_machine_name:taxonomy_machine_name +diff --git a/src/Form/Settings.php b/src/Form/Settings.php +new file mode 100644 +index 0000000000000000000000000000000000000000..0476b6b19e4e8053c0fb73742c1e8e75cd531cc8 +--- /dev/null ++++ b/src/Form/Settings.php +@@ -0,0 +1,54 @@ ++<?php ++ ++namespace Drupal\taxonomy_machine_name\Form; ++ ++use Drupal\Core\Form\ConfigFormBase; ++use Drupal\Core\Form\FormStateInterface; ++ ++/** ++ * Configure Taxonomy Machine Name settings for this site. ++ */ ++final class Settings extends ConfigFormBase { ++ ++ /** ++ * {@inheritdoc} ++ */ ++ public function getFormId(): string { ++ return 'taxonomy_machine_name_settings'; ++ } ++ ++ /** ++ * {@inheritdoc} ++ */ ++ protected function getEditableConfigNames(): array { ++ return ['taxonomy_machine_name.settings']; ++ } ++ ++ /** ++ * {@inheritdoc} ++ */ ++ public function buildForm(array $form, FormStateInterface $form_state): array { ++ $config = $this->config('taxonomy_machine_name.settings'); ++ ++ $form['hide_machine_name_in_terms_overview'] = [ ++ '#type' => 'checkbox', ++ '#title' => $this->t('This hides the machine name in the terms overview.'), ++ '#default_value' => $config->get('hide_machine_name_in_terms_overview'), ++ '#description' => $this->t('By default, the machine name is displayed.'), ++ ]; ++ ++ return parent::buildForm($form, $form_state); ++ } ++ ++ /** ++ * {@inheritdoc} ++ */ ++ public function submitForm(array &$form, FormStateInterface $form_state): void { ++ $config = $this->config('taxonomy_machine_name.settings'); ++ $config->set('hide_machine_name_in_terms_overview', ++ $form_state->getValue('hide_machine_name_in_terms_overview')); ++ $config->save(); ++ parent::submitForm($form, $form_state); ++ } ++ ++} +diff --git a/taxonomy_machine_name.info.yml b/taxonomy_machine_name.info.yml +index 1ec84a8daba43059a61f8345c987e8524f05e206..533d41372b4be7ec1388ef03967c9c0a9eca4872 100644 +--- a/taxonomy_machine_name.info.yml ++++ b/taxonomy_machine_name.info.yml +@@ -2,7 +2,7 @@ name: Taxonomy Machine Name + description: Provides a new property to store machine name for taxonomy terms. + type: module + package: Other +-core_version_requirement: ^9.4 || ^10 ++core_version_requirement: ^10 || ^11 + + dependencies: + - drupal:taxonomy +diff --git a/taxonomy_machine_name.install b/taxonomy_machine_name.install +index 55607499a02cd6eac59956ed1fcfd6924d7f3662..a3a996e3832482276919faa576c8f08e4a872aa7 100644 +--- a/taxonomy_machine_name.install ++++ b/taxonomy_machine_name.install +@@ -43,10 +43,10 @@ function taxonomy_machine_name_update_8001(array &$sandbox = NULL) { + /** + * Update machine names for existing terms, usable both in batch and update. + * +- * @param array $context ++ * @param array|DrushBatchContext $context + * The $context parameter in updates, called $context in Batch API. + */ +-function taxonomy_machine_name_update_all_terms(array &$context) { ++function taxonomy_machine_name_update_all_terms(&$context) { + $sandbox = &$context['sandbox']; + if (empty($sandbox['tids'])) { + // Size of the batch to process. +diff --git a/taxonomy_machine_name.links.menu.yml b/taxonomy_machine_name.links.menu.yml +new file mode 100644 +index 0000000000000000000000000000000000000000..d06f5425102a95f63c60439aba59e77e52636051 +--- /dev/null ++++ b/taxonomy_machine_name.links.menu.yml +@@ -0,0 +1,6 @@ ++taxonomy_machine_name.settings: ++ title: Taxonomy Machine Name ++ description: Configure Taxonomy Machine Name ++ parent: system.admin_config_ui ++ route_name: taxonomy_machine_name.settings ++ weight: 10 +diff --git a/taxonomy_machine_name.module b/taxonomy_machine_name.module +index de7468cbabc03d32016c4b721098871482153ffb..1765908f715f042e8d6559af6380858a6835fa1c 100644 +--- a/taxonomy_machine_name.module ++++ b/taxonomy_machine_name.module +@@ -37,6 +37,11 @@ function taxonomy_machine_name_entity_base_field_info(EntityTypeInterface $entit + * Implements hook_form_FORM_ID_alter(). + */ + function taxonomy_machine_name_form_taxonomy_overview_terms_alter(&$form, FormStateInterface $form_state, $form_id) { ++ $shouldHide = Drupal::config('taxonomy_machine_name.settings') ++ ->get('hide_machine_name_in_terms_overview'); ++ if($shouldHide) { ++ return; ++ } + $user = \Drupal::currentUser(); + if($user->hasPermission('view machine name overview page')) { + if (isset($form['terms']['#header'])) { +diff --git a/taxonomy_machine_name.routing.yml b/taxonomy_machine_name.routing.yml +new file mode 100644 +index 0000000000000000000000000000000000000000..837855b11344d084993c967e1af32591e059a5ce +--- /dev/null ++++ b/taxonomy_machine_name.routing.yml +@@ -0,0 +1,7 @@ ++taxonomy_machine_name.settings: ++ path: '/admin/config/user-interface/taxonomy_machine_name' ++ defaults: ++ _title: 'Taxonomy Machine Name' ++ _form: 'Drupal\taxonomy_machine_name\Form\Settings' ++ requirements: ++ _permission: 'administer site configuration' +\ No newline at end of file diff --git a/patches/d11.json b/patches/d11.json index 323370d..c878243 100644 --- a/patches/d11.json +++ b/patches/d11.json @@ -206,7 +206,7 @@ "drupal/taxonomy_machine_name": { "#3193233 Filter doesn't work": "https://www.drupal.org/files/issues/2021-01-17/taxonomy_machine_name-view-save-error-3193233.patch", "#3128397 View can not be saved": "https://www.drupal.org/files/issues/2020-04-16/config_schema-3128397-3.patch", - "#3352586 Parameter to disable machine name in terms overview ": "https://git.drupalcode.org/project/taxonomy_machine_name/-/merge_requests/8.diff" + "#3352586 Parameter to disable machine name in terms overview ": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3352586-2.diff" }, "drupal/taxonomy_manager": { "#3474919 Form element taxonomy_manager_tree broken": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3474919.diff" -- GitLab