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.
Problem/Motivation
At some point, the search block could not be made cacheable. It had to do with CSRF tokens. But… the search form is a GET form, which doesn't use CSRF tokens. So there's no reason not to make it cacheable.
Proposed resolution
Make it cacheable.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#3 | search_block_cacheable-2497307-3.patch | 3.12 KB | Wim Leers |
Comments
Comment #1
Wim LeersComment #3
Wim LeersRoot cause: missing cache tags for the config that the search block form depends upon.
Requires an unfortunate solution because
SearchPageRepository
is designed in an unfortunate way.Comment #4
dawehnerAwesome!!
I'm curious whether you've thought about just doing
$form['#cache']['dependencies'][]
and handle the rest internally?Comment #5
Wim LeersNo. And first I thought this was a stroke of utter genius. But then I realized that it may mean we end up serializing objects. Then again, the rendering could take care of that.
So I think it it actually may be a stroke of genius :) :) :) @dawehner++
Comment #6
catchCommitted/pushed to 8.0.x, thanks!