My setup:
Drupal v7.2
views v7.x-3.0-rc1
ctools v7.x-1.0-rc1
I see that views UI lets you enable the option "Use replacement tokens from the first row" for the No Results behavior, and also specify tokens in the body of the textarea to be displayed in case of no results. However, the tokens don't seem to actually be replaced with anything, e.g. one sees the token code unchanged in the rendered view:
"No results available for !1."
"No results available for [nid]."
Perhaps I misunderstand, but is a discrepancy between the assumed data source for the tokens, i.e. the rows returned by the SQL query, and the fact that the No Results behavior should only be triggered when there are *no* rows available?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1245524-token.patch | 575 bytes | dawehner |
Comments
Comment #1
dawehnerCan you please show your view? Therefore provide an export of your view.
Comment #2
westbywest commentedHere is an export of a simple view demonstrating the tokens in the No Results text not being processed. It has a just a page display, with url /test-view/% , where % = nid of a page node to display.
I do see that the '%1' token appears to be processed (i.e. it is replaced with ''), but the others do not.
Comment #3
dawehnerOh thanks for providing a reusable export!!! Kudos
Supporting [nid] is not possible because it has to be part of the result.
% seems to work already at least on dev.
! isn't supported but this patch adds the feature.
In general all this token handling should be united again.
Comment #4
bojanz commentedI see this patch has already been committed:
Comment #6
joshuautley commentedRe: #3 "Supporting [nid] is not possible because it has to be part of the result."
Bummer. It would be nice to be able to use the tokens [user:name] or any of the fields made available such as [name] in an effort to personalize the "no results" response.
Example:
You have not upload a photo album yet.
[user:name], you have not uploaded a photo album yet
OR
This user has not uploaded a photo album yet.
[user:name] has not uploaded a photo album yet
Comment #7
Yuri commentedHere is a workaround: https://drupal.org/node/1895724