Problem/Motivation
The button to open the modal window with the taxonomy tree breaks if it finds any HTML elements in the path, causing an Ajax 404 error.
If $dialog_title has any HTML elements such as strong, span, em, etc., it breaks the URL and causes a 404 error.
Context: After applying this community patch https://www.drupal.org/files/issues/2025-08-13/fix-wrong-parameter-type-... (3538860 - TypeError: preg_match(): Argument #2 ($subject) must be of type string...) the modal window stopped working, giving a 404 error when trying to open the window.
Steps to reproduce
- Add the mentioned patch
- Try to open the modal window
- See the error
Message error:
Uncaught
Object { message: '\nAn AJAX HTTP error occurred.\nHTTP Result Code: 404\nDebugging information follows.\nPath: /admin/entity_reference_tree/search/edit-field-user-roles-0-target-id/user_roles/taxonomy_term/default/0?limit=-1\nStatusText: error\nResponseText: {"message":"No route found for \\u0022POST https:\\/\\/site.com\\/admin\\/entity_reference_tree\\/search\\/edit-field-user-roles-0-target-id\\/name\\/taxonomy_term\\/default\\/0\\u0022 (from \\u0022https:\\/\\/site.com\\/node\\/118\\/edit?destination=\\/admin\\/content\\u0022)"}', name: "AjaxError", stack: etc...Proposed resolution
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | entity_reference_tree-ajax_404_fix.patch | 681 bytes | andreadruiz |
Comments
Comment #2
andreadruiz commentedComment #3
andreadruiz commentedAdding this patch to solve the issue (remove the HTML tags that could break the URL in the modal window).
Comment #4
andreadruiz commentedComment #5
mingsongComment #7
mingsongThanks.
Fixed with 2.4.2