When passing context arguments into CTools views_content panes, if arguments are empty the values for those arguments are omitted from the arguments array.

Based on a comment in the code of the else statement, "Make sure we put an argument in even if it was not there.", this was a simple oversight in the programming.

Patch to follow.

Comments

codycraven’s picture

Status: Active » Needs review
StatusFileSize
new740 bytes

Moving the array_splice to insert the $arg value into the $args array from the if condition to outside of the condition block solves the issue.

johnle’s picture

Status: Needs review » Reviewed & tested by the community

I've just tested this and the arrays are now being preserve with null values, instead of of having their arguments remove. This works perfectly when passing multiple arguments into the views from panels now.

codycraven’s picture

#1863166: Bad arguments when first optional context argument is unavailable appears to be a duplicate issue.

I did not find that the issue existed before I posted the issue and patch here.

codycraven’s picture

Issue summary: View changes

Fixed grammar tense

japerry’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

checker’s picture

This patch does not work well with views and panels arguments. See #2198447: Arguments not being send from Panels to Views with ctools 1.4 and #2196197: Send Arguments: //%1.

japerry’s picture

Status: Closed (fixed) » Needs work

Re-opening. I've reverted the commit because I cannot accurately test this patch and get a fix in a day. If someone with more experience here can test this, It'd be great to see the original issue fixed without causing the regression.

y0shi’s picture

I can confirm this commit broke views getting arguments (took a while to debug.. unfortunately I found the bug AFTER it was reverted)

geek-merlin’s picture

I'm quite sure views chokes on NULL arguments, so try using '' instead:
Replace

$arg = NULL;

with

$arg = '';

  • japerry committed 1887d8d on 8.x-2.x authored by codycraven
    Issue #1917658 by codycraven: Empty context value results in missing...
  • japerry committed f82a228 on 8.x-2.x
    Revert "Issue #1917658 by codycraven: Empty context value results in...

  • japerry committed 1887d8d on 8.x-3.x authored by codycraven
    Issue #1917658 by codycraven: Empty context value results in missing...
  • japerry committed f82a228 on 8.x-3.x
    Revert "Issue #1917658 by codycraven: Empty context value results in...