When you deal with an contextual filter handler, the pre_query method doesn't include all the arguments built so you can't modify the handler's behavior in that phase (or any other phase) based in default arguments provided, just the url arguments.
Example: views_handler_argument_term_node_tid_depth_modifier uses pre_query to alter the depth of a taxonomy query based in arguments from the url, I need to provide a default argument #1324648: Allow options form for taxonomy depth modifier argument so the depth comes from any other place but the url (php, fixed, defaults..) but when pre_query gets triggered, the only information about the arguments is the url one and should be the whole context.
Attaching a patch that prioritizes the argument building on top of other component's build.
Comment | File | Size | Author |
---|---|---|---|
#4 | 1324580-prioritize_building_arguments-3.patch | 2.29 KB | dawehner |
#2 | 1324580-prioritize_building_arguments-3.patch | 2.33 KB | pcambra |
views-prioritize_building_arguments-0.patch | 1.2 KB | pcambra | |
Comments
Comment #1
pcambraSetting to needs work as dereine pointed out flaws of this solution, new patch is coming.
Comment #2
pcambraPatch improved vastly by dereine, just in case someone else wants to test this out.
Not sure if we need to set the relationship ($argument->set_relationship();) at this point.
Comment #3
pcambraComment #4
dawehnerHere is a new version with the removed set_relationship. This is too early so you might not get the relationships, because they aren't initialized.
I would like to get feedback from merlinofchaos here.
Comment #5
dawehnerThanks for helping figuring this out.
Committed to 6.x-3.x and 7.x-3.x
Comment #6
dawehnerThis issue has caused #1373966: Views block is not hidden when argument on node ID is empty to fail. So i reverted both 6.x-3.x and 7.x-3.x. So this issue needs a patch which works on 6.x-3.x and 7.x-3.x at the same time sorry for that.
Luckily it turns out that this is only a problem of 6.x-3.x but still to be fixed.
Comment #7
caktux CreditAttribution: caktux commentedGetting the same issue as #1373966: Views block is not hidden when argument on node ID is empty but with 7.x-3.0 :(
Not sure if it's related but I also get triple "Base path" and "Display record count with link" form parts from "Display a summary" when choosing "Provide default value"...
Comment #8
robertstaddon CreditAttribution: robertstaddon commentedI am experiencing the exact same problems as @caktux with 7.x-3.0. Never had the problems in any of the Views release candidates.
Comment #9
pcambraBut this patch didn't make it to stable, did it?
I think dereine reverted it before pushin 7.x-3.0.
Comment #10
dawehnerNo actually the revert was after the stable release.
Comment #10.0
dawehnerAdded related issue