public function webform_handler_field_node_link_results::render_link in Webform 7.4
Same name and namespace in other branches
- 7.3 views/webform_handler_field_node_link_results.inc \webform_handler_field_node_link_results::render_link()
Renders the link.
Overrides views_handler_field_node_link::render_link
File
- views/
webform_handler_field_node_link_results.inc, line 35
Class
- webform_handler_field_node_link_results
- Views handler to display a results link for Webform submissions.
Code
public function render_link($node, $values) {
// Ensure node is webform-enabled and the user has access node's webform
// results.
if (!in_array($node->type, webform_node_types()) || !webform_results_access($node)) {
return;
}
// For clear, ensure user has access to clear all the submissions.
if (stripos($this->options['subpath'], 'clear') === 0 && !user_access('delete all webform submissions')) {
return;
}
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "node/{$node->nid}/webform-results" . (strlen($this->options['subpath']) ? '/' . $this->options['subpath'] : '');
$text = !empty($this->options['text']) ? $this->options['text'] : t('results');
return $text;
}