Suppose that the default behavior of the last argument of a view is set as "Summary, unsorted". This way if the argument is not provided a summary based on this argument is displayed. Well, if such view is included in a panel, with the intention to display a summary, the most reasonable is to set this argument source as "No Argument" so that the view get rendered as a summary (this is the default behavior of the view when the argument is not provided).
In panels_views_render the "No argument" case is handled in this way:
case 'none':
default:
$args[] = $view->arguments[$id]['wildcard'] ? $view->arguments[$id]['wildcard'] : '*';
// Put in the wildcard.
break;
}
The argument is replaced with the argument willcard, and thereby, the summary is not rendered, all the values are showed instead.
Following the idea of the arguments handling implementation found on views.module, the arguments not provided are not replaced by willcards, they are processed in accordance with the default behavior set (Summary, display page not found, display empty text, display all values, etc... )
So, following this idea, the correct code for this case, in my opinion, should be like this:
case 'none':
default:
break 2; // switch and foreach
Similar to views.module, just skips the switch and the foreach and do not provide more parameters to the view so that it can perform as if the parameters had been provided by URL.
What do you guys think about ?
Please comment.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | panels-views-arguments-218193.patch | 1.54 KB | dropcube |
| #4 | panels-views-arguments-none.patch | 771 bytes | dropcube |
Comments
Comment #1
merlinofchaos commentedThe problem here is...let's say you have 3 arguments.
#1 is set
#2 is 'no argument'
#3 is set.
You *must* put something in in that situation.
Comment #2
dropcube commentedSupposing we have a view, for example, with 4 arguments, and we have to include such view in a panel with the intention to display a summary based on the 3rd argument. So, we have
#1 is got from panel argument
#2 is 'fixed' (with a value or with a wildcard)
#3 is 'no argument'
#4 is 'no argument'
In this case, #3 and #4 should not be provided to the view as a wildcards. If we need to display a summary, then we need to provide only the two first arguments to the view so that it get rendered as we expect.
In my opinion we should consider at least the case when the 'last' arguments are 'no argument'. This way views arguments order can be organized to deal with this.
Comment #3
merlinofchaos commentedCan you provide a patch?
Comment #4
dropcube commentedWon't be better in the case of 'no argument' to provide
NULLas the argument instead of a wildcard ? Providing NULL views.module knows what to do withNULL(or missing) arguments, that is, render the view as a summary, or display page not found, or whatever was specified in the view.If 'no argument' is set as the argument source, then we do not provide an argument to the view, we provide
NULL. If a wildcard is required as the argument, then we may set 'fixed' and provide '*' or set 'input on pane config', and provide '*' on pane config, etc... ('*' or the wildcard used) .Does make sense ?
The patch attached implements this. I have tested and is working as expected.
Comment #5
merlinofchaos commentedHmm. In my mind, 'no argument' translated better to the wildcard, but I can see where this is confusing. Fixing it to the wildcard makes sense as an alternative. I think providing an option might be more user friendly, though. i.e, adding "Wildcard argument" to the list of options.
Not that most people know what the wildcard argument actually means. Heh.
Comment #6
dropcube commentedOk, providing an option for the wildcard is more user friendly and give us the possibility to have "wildcard arguments" and "no arguments". This way, summary views may be generated selecting "No argument" and providing NULL as the argument (views.module actually knows what to do with NULL or missing arguments). Selecting "Argument wildcard", then the argument wildcard will be provided as the argument. So, we have the following options:
and the argument handling code like this:
The patch attached implements the above.
Comment #7
dropcube commentedComment #8
merlinofchaos commentedCommitted! Sorry this took so long; this should've gone in months ago.
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #10
socialnicheguru commentedsubscribing
Comment #11
darren ohThis patch accidentally reversed a fix from CVS commit 114926.