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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

Status: Needs review » Needs work

Setting to needs work as dereine pointed out flaws of this solution, new patch is coming.

pcambra’s picture

Patch 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.

pcambra’s picture

Status: Needs work » Needs review
dawehner’s picture

Assigned: Unassigned » merlinofchaos
FileSize
2.29 KB

Here 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.

dawehner’s picture

Status: Needs review » Fixed

Thanks for helping figuring this out.

Committed to 6.x-3.x and 7.x-3.x

dawehner’s picture

Status: Fixed » Needs work

This 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.

caktux’s picture

Getting 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"...

robertstaddon’s picture

I am experiencing the exact same problems as @caktux with 7.x-3.0. Never had the problems in any of the Views release candidates.

pcambra’s picture

But this patch didn't make it to stable, did it?
I think dereine reverted it before pushin 7.x-3.0.

dawehner’s picture

No actually the revert was after the stable release.

dawehner’s picture

Issue summary: View changes

Added related issue