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.
Can patterns manage this via the views tag? Or does a custom form tag option need to be set?
Comment | File | Size | Author |
---|---|---|---|
#4 | patterns-453026.patch | 2.39 KB | cdale |
#1 | patterns-views-override-display.patch | 915 bytes | cdale |
Comments
Comment #1
cdale CreditAttribution: cdale commentedI've created a small patch which achieves this. My first attempt was trying to use the Form API to call the correct override action, then call the form again to save the value, but this proved difficult to get to work, so I've opted with just doing what the override submit handler does. It works well.
Example usage is as follows:
Comment #2
cdale CreditAttribution: cdale commentedOops. That example YAML needs to remove the second override option, as views overrides all those items together....
Comment #3
cdale CreditAttribution: cdale commentedI've change the patch, so that it now handles override options on the display settings, as well as the handlers. I've also added the ability to remove handlers as I couldn't see this done anywhere. There is also a bug fix for getting the correct display id on the item for update actions. Sorry for bundling this all together. I can break them out into separate patches if it is an issue.
This patch can be used with the following pattern to have a default and page view using a node.created sort handler, and a block using a views.random sort handler.
Comment #4
cdale CreditAttribution: cdale commentedForgot the patch
Comment #5
vaish CreditAttribution: vaish commentedI'm really sorry for not getting to this earlier. This was very much needed addition to the views component. Patch committed.
I'm marking this issue as "needs work" because re-running the pattern produces some weird results: all sort options are removed for all the displays and options that were overridden by block display end up applied to all other displays as well. There is a good chance that this is not directly related to this patch but definitely something that we should try to fix. I'm not sure when I will have a time to look into this further.