Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I need to place the selected taxonomy term from drop down list into my custom search path. [key] token is replaced only by what is entered in basic search box, which in my case is hidden. Is there any way to get [key] replaced by the value of selected option ?
BTW I changed the code from custom_search_taxonomy_form_alter function so it prints the values for options just as $term->tid, without the "c-" prefix, so I could use it as argument for my view search ...
Thanks,
Michal
Comment | File | Size | Author |
---|---|---|---|
#3 | terms_as_pattern.jpg | 141.04 KB | athanor |
#3 | terms-id_as_pattern.jpg | 157.88 KB | athanor |
Comments
Comment #1
athanor CreditAttribution: athanor commentedI have three blocks with custom search boxes and each one has the same value of "custom_search_blocks_form" in inputs named "form_id" ...
Is this the correct way of how it should be done ?
Comment #2
jdanthinne CreditAttribution: jdanthinne commentedPlease download the DEV version, I've just added a [terms] token for the custom path.
Please review.
Comment #3
athanor CreditAttribution: athanor commentedI tried with [terms] and [terms-1] for vocabulary number 1 without success. When using [terms-1] i'm getting %252F value instead of the "c-3". [terms] aren't replaced by anything ...
I'm still concerned about same value of a form_id input. All three of them have "custom_search_blocks_form", without any IDs
Thank you,
Michal
Comment #4
jdanthinne CreditAttribution: jdanthinne commentedI've just committed changes to the DEV version.
I've reworked the whole process, not easy... just enter the [terms] token, and chose the terms separator below, and tell me if it works.
For the form_id value, that's normal, it's an internal (and hidden) input value created by Drupal (kind of "which module created this?" -> answer : "custom_search_blocks"). Don't worry about that.
Comment #5
athanor CreditAttribution: athanor commentedI'm afraid it still does not work, at least for me ;) [terms] are replaced with %252F instead of selected taxonomy term id when path is defined like this: search/category/[terms]/[key]
And is empty when path looks like: search/category/[key]/[terms] ...
Thanks anyway ;)
Comment #6
jdanthinne CreditAttribution: jdanthinne commentedStrange, it seems to be working on my side.
Do you have a test url where I can check your config?
Comment #7
jdanthinne CreditAttribution: jdanthinne commentedI think that you were right about this form_id... can be a part of the problem, and opened a new issue for that (#971456: Blocks settings not submitted with multiple blocks).
Comment #8
jdanthinne CreditAttribution: jdanthinne commentedI think I've fixed #971456: Blocks settings not submitted with multiple blocks…
Please download the new DEV version, and tell me if things are better for you.
Comment #9
athanor CreditAttribution: athanor commentedThanks jdanthinne. [term] replacement works fine, but [key] only in first block, in 2nd and 3rd returns empty values ...
Comment #10
jdanthinne CreditAttribution: jdanthinne commentedStrange. With my latest version, all blocks behaves as expected.
Can you tell me, for each block, what is the resulting url and what is written in the results page's search box.
Additionnaly, can you send me a copy of the source code generated for a page where all the blocks are included and what is their respective configuration, so I can try with the same settings.
Comment #11
jdanthinne CreditAttribution: jdanthinne commented