Provide a hook to alter the parameters

Created on 5 March 2020, over 4 years ago
Updated 8 April 2024, 6 months ago

Can we please have a hook that can alter the list of excluded URL parameters? I'd like to have modules define what parameters are excluded without having to force a configuration update on each site.

Say I include a JS front-end component that uses the 'itemCount' parameter... then I could just define that in the module hook and it'll all work. Rather than having to then go and update the page cache config.

Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

🇦🇺Australia nterbogt

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands seanB Netherlands

    Patch is attached to implement a hook that allows the parameters to be altered.

  • 🇦🇺Australia nterbogt

    Updating to 2.x-dev.

  • Merge request !5Provide an alter hook → (Open) created by nterbogt
  • Status changed to Needs work 6 months ago
  • 🇦🇺Australia nterbogt

    Thank you for you submission. Converted patch to merge request.

    Now all this needs is tests.

  • 🇳🇱Netherlands seanB Netherlands

    Thanks for the MR! Also, to weigh in on the discussion about alter hooks vs other ways of changing the parameters: we want the way to alter this to be as lightweight as possible. Cached pages should be served with minimal overhead.

    When getting the defined parameters, we can't even rely on everything in the container yet. The module handler works, but I still had to force it to load all .module files. Using the event system could become problematic, same goes for plugins. Dependency injection could easily lead to a circular reference (found that out the hard way while trying to do fancy stuff in my implementation of the hook).

    Overall, hooks still have their place in the Drupal universe and I don't see that changing anytime soon.

Production build 0.71.5 2024