Problem/Motivation
We have a use case where the Search Block URL is not static, and need to adapt to the current page it's placed on. It would be great to use token replacement values to assign a current page URL, which tokens can be expanded for all types of use cases.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | search_api_block_provide_token_support-3320536-5.patch | 6.03 KB | phjou |
| #2 | search_api_block_provide_token_support-3320536-2.patch | 5.98 KB | droath |
Comments
Comment #2
droath commentedComment #3
droath commentedComment #4
phjouGood job droath! Nice feature.
I found two things:
- The patch was crashing when the block was placed on a page that is not a node. So we need ", required = FALSE" in the contextdefinition
- Why not applying the token replacement on the input name as well, that gives more power to content editors
I will make these adjustments and merge.
Comment #5
phjouComment #7
phjouComment #8
fjgarlin commentedThis introduced a regression if the "node" module is not enabled. I know it's not very common on Drupal sites but totally possible.
Before the update, it all works, after the update:
Running a trace, the error is in "SearchBlock.php":
I'll open a follow up issue with all the above info.