I have a view (using the calendar module), which displays a title field for each displayed event. The title field is set to "link this field to the original piece of content".
I'd like to rewrite that link to add some additional parameters, e.g. ?return_view=myview, so that I can link back to the view page from the content. The content might be linked to from any one of several different views, so it needs to take some parameter (i.e. return_view) to tell it what to link back to.
I've tried adding a hook_views_pre_render:
function mymodule_views_pre_render(&$view) {
if ($view->name == 'myview') {
foreach ($view->result as &$r) {
$r->node_title = array(
'#theme' => 'link',
'#text' => 'xyz',
'#path' => 'node/' . 123,
'#options' => array(
'query' => array(
'rv' => $view->name,
'rvd' => $view->current_display
),
'attributes' => array(),
'html' => FALSE
)
);
}
}
}
But that just leads to Drupal complaining that "warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()" - I'm assuming because some rendering function somewhere expects to get a plain string.
What's the cleanest way to add additional query parameters to a node title rendered by views?