problem:
- base of problem is a views query, where node table is joined via left join to any other base table, whereas there might be result datasets, where there is no match for a node dataset -> node ID in final query result for this datasets is NULL
- in case of node ID is returned as "NULL" from DB, no change on variables for link-to-node generation is done in views_handler_field_node::render_link(). If there was correct link-to-node generation in previous data-row, handler options stay in place for the field rendering of the row, where NULL is delivered as "node ID".
- if view option "hide, if empty" is checked for the diplaying of the field "Node ID", this causes no problem since no output content is generated
- There is a problem, if you overwrite the content of field "Node ID" via token in views UI. In this case, there might be a field content (eg. from previous colums) despite there is a NULL value returned as node ID from views query. In current implementation, the link-to-node from previous data row is applied to this field content, leading faulty linking. For me it is appreciated that there is no link-to-node if it is NULL returned as node ID from DB and despite this fact there is a valid field content (eg. by token usage).
I added a patch, which fixed my problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views_handler_field_node.patch | 794 bytes | dawehner |
| views_handler_field_node.patch | 577 bytes | TS79 |
Comments
Comment #1
dawehnerThats bad code style :)
But it should be fixable.
Comment #2
dawehnerUpdate codestyle
Comment #3
TS79 commentedimplementation works
Comment #4
merlinofchaos commentedCommitted to all branches.
Comment #6
quartsize commentedI believe this causes a regression; it has disabled the use of "Output this field as a link" on fields that also have the option to "Link this field to its node" (e.g. "node: title"), since the else block inserted by this patch sets $this->options['alter']['make_link'] false before it is checked by views_handler_field::render_text().
Alas, I do not understand the original problem well enough to fix this patch.
Comment #7
dawehnerSee #941990: "Link this field to its node" incorrectly output path "node/nid"
Comment #8
TS79 commented#941990: "Link this field to its node" incorrectly output path "node/nid" fixed this issue as well meanwhile