I am developing a module which enables limited HTML in node titles and I am having difficulty finding the best way to enable this in Views displays with a field row style. I can achieve the desired result with a theme template named "views-view-field--title.tpl.php" because the $output value presented to this template seems to be the pre-rendered title (has not yet been wrapped with a link or any other markup). This isn't really a solution for a module though because this template could be overridden by the theme.
If I theme the title with a theme hook theme_views_view_field__title() it overrides the views theme which handles node linking and any other wrapper markup. How can I pass theming back to views for this field at some point AFTER the title would have been sanitized?
I considered the possibility of overriding the field handler for node titles but I can't figure out a way to do that and I suspect it isn't possible. If it is I would love to learn how.
The bit I need to override is the render() method in views_handler_field_node.inc to change the sanitation logic to XSS instead of plain.
function render($values) {
$value = $this->get_value($values);
return $this->render_link($this->sanitize_value($value), $values);
}
Comments
I've solved this by theming
I've solved this by theming 'views_view_field__title' and using a placeholder to store and replace the unsanitized title after letting views render it. This isn't optimal but it works.