🇯🇵Japan @hirakuro

Account created on 23 March 2020, over 4 years ago
#

Recent comments

🇯🇵Japan hirakuro

In my case, finally I got this workaround.
Note that this includes a menu name for menu_breadcrumbs in my site, so you can not use this directly.

--- core/lib/Drupal/Core/Menu/MenuTreeStorage.php.orig	2023-07-13 16:19:51.661163432 +0900
+++ core/lib/Drupal/Core/Menu/MenuTreeStorage.php	2023-07-13 16:21:07.000000000 +0900
@@ -665,7 +665,17 @@
     $query = $this->connection->select($this->table, NULL, $this->options);
     $query->fields($this->table, $this->definitionFields());
     $query->condition('route_name', $route_name);
+    if ($route_name == 'entity.taxonomy_term.canonical' && $menu_name == 'MENU_FOR_menu_breadcrumbs') {
+      $q_group = $query->orConditionGroup()
+        ->condition('route_param_key', $param_key)
+        ->condition('route_param_key', "{$param_key}\\&%", 'LIKE');
+
+      $query->condition($q_group);
+    } else {
     $query->condition('route_param_key', $param_key);
+    }
     if ($menu_name) {
       $query->condition('menu_name', $menu_name);
     }
🇯🇵Japan hirakuro

because SQL like `WHERE route_param_key = 'taxnomy_term_145'` in the module

I'm sorry. The sql is executed in MenuTreeStorage::loadByRoute() called by menu_breadcrumbs through MenuLinkManager::loadLinksByRoute().

🇯🇵Japan hirakuro

Hello, I think I'm facing a problem of this issue. But the patch of #30 not work for me.
So I tried to read records of menu_tree.

Data in 9.5.8 is below:

MySQL [drupal]> SELECT menu_name, route_name, route_param_key FROM menu_tree WHERE menu_name = 'breadcrumbs' LIMIT 6;
+-------------+--------------------------------+-------------------+
| menu_name   | route_name                     | route_param_key   |
+-------------+--------------------------------+-------------------+
| breadcrumbs | view.news_and_topics.page_2    | arg_0             |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=145 |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=143 |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=149 |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=147 |
| breadcrumbs | view.news_and_topics.page_2    | arg_0             |
+-------------+--------------------------------+-------------------+

Data in 9.5.9 with patch #30, after drush cache:rebuild is below:

MySQL [drupal]> SELECT menu_name, route_name, route_param_key FROM menu_tree WHERE menu_name = 'breadcrumbs' LIMIT 6;
+-------------+--------------------------------+-----------------------------------------------------------+
| menu_name   | route_name                     | route_param_key                                           |
+-------------+--------------------------------+-----------------------------------------------------------+
| breadcrumbs | view.news_and_topics.page_2    | arg_0&view_id=news_and_topics&display_id=page_2           |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=145&display_id=page_1&view_id=taxonomy_term |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=143&display_id=page_1&view_id=taxonomy_term |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=149&display_id=page_1&view_id=taxonomy_term |
| breadcrumbs | entity.taxonomy_term.canonical | taxonomy_term=147&display_id=page_1&view_id=taxonomy_term |
| breadcrumbs | view.news_and_topics.page_2    | arg_0&view_id=news_and_topics&display_id=page_2           |
+-------------+--------------------------------+-----------------------------------------------------------+
6 rows in set (0.001 sec)

I'm using this "breadcrumbs" menu with menu_breadcrumb module and breacrumbs of my site by the module are currently broken, because SQL like `WHERE route_param_key = 'taxnomy_term_145'` in the module not working properly by this problem.

I think this expanding `route_param_key` is from #3277784 🐛 copyRawVariables should support default route parameters Fixed and it may be fixed #2 patch, but I did not try yet.
I'm afraid of applying #2 patch causing any other problems or conflict with internal data structure of future version of Drupal.

Could anybody give me some advice?

Production build 0.71.5 2024