Description:
1. Add a views url field (any field that uses views_handler_field_url, e.g. Node: Link) and check the option "Display as link"
2. Add a "Global: Contextual Links" field, and assign the field from step 1 as a contextual link
Expected behavior:
the field from step 1 renders as a link inside the contextual links
Actual behavior:
the field from step 1 is html-encoded, and the link is ignored
Proposed solution:
set values in the options['alter'] array instead of returning a rendered link (similar to the way it works in views_handler_field_node_link)
Comments
Comment #1
aaronbaumanComment #2
aaronbaumans/p0/p1/
Comment #4
dawehnerThis looks fine, beside a little thing.
Shouldn't you better set html to TRUE as well?
Comment #5
aaronbaumanThe code is pulled directly from views_handler_field_node_link.inc, which does not change 'html' to TRUE.
Either it's up to the user whether they're including HTML in their rewrite values, or it's up to Views to assume that 'make_link' implies 'html'.
aaand i uploaded the same file twice.
here's the new patch.
Comment #6
dawehnerThis patch looks fine from my perspective.
Comment #7
dawehnerBefore the commit i'm wondering why $this->options['text'] is not sanitized but the actual value is? Both could be user input ...
Comment #8
aaronbaumanActually, i think neither value needs to be sanitized.
Does views decide later, based on other views options, whether the value should contain HTML?
I'm not 100% intimate with views' rendering pipeline.
views_handler_field_node_link.inc does not sanitize
$this->options['text']either, so I assumed it was unnecessary.Comment #9
dawehnerWell render_as_link sets html to TRUE, so you have to sanitize the value in the render method, see views_handler_field::render()
Comment #10
aaronbaumanok, i understand now.
Comment #11
dawehnerLooks perfect now!
Comment #12
dawehnerPerfect! Finally committed to 7.x-3.x and 8.x-3.x