You are here

public function fasttoggle_node_views_handler_field_node_link::render_link in Fasttoggle 7

Overrides views_handler_field_node_link::render_link

1 call to fasttoggle_node_views_handler_field_node_link::render_link()
fasttoggle_node_views_handler_field_node_link::render in module/fasttoggle_node/views/fasttoggle_node_views_handler_field_node_link.inc
Render the field.

File

module/fasttoggle_node/views/fasttoggle_node_views_handler_field_node_link.inc, line 51
The field node link views handler for fasttoggle.

Class

fasttoggle_node_views_handler_field_node_link
This file defines the Views handler for rendering fasttoggle links.

Code

public function render_link($node, $values) {
  if (!node_access('update', $node)) {
    return '';
  }
  drupal_load('module', 'fasttoggle');

  // Now we set the status to the actual value so that we get the
  // correct labels.
  $options = fasttoggle_get_allowed_links('node', $node, $node->nid, 'fasttoggle_togglable_options');
  $key = $this->fasttoggleKey;
  if (!empty($options['fields']['status']['instances'][$key])) {
    $link_info = fasttoggle($options, 'status', $key, $node, FASTTOGGLE_FORMAT_LINK_ARRAY);
    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = $link_info['href'];
    $this->options['alter']['text'] = $link_info['title'];
    $this->options['alter']['query'] = $link_info['query'];
    $this->options['alter']['link_class'] = implode(' ', $link_info['attributes']['class']);
    $this->options['alter']['title'] = $link_info['attributes']['title'];
    return $link_info['title'];
  }
}