1 views_handler_field_links.inc views_handler_field_links::get_links()

Internal function to get a list of links for this field.

File

core/modules/views/handlers/views_handler_field_links.inc, line 57
Definition of views_handler_field_links.

Class

views_handler_field_links
Provides a handler that adds a field of links.

Code

function get_links() {
  $links = array();
  foreach ($this->options['fields'] as $field) {
    if (empty($this->view->style_plugin->rendered_fields[$this->view->row_index][$field])) {
      continue;
    }
    $title = $this->view->field[$field]->last_render_text;
    $path = '';
    if (!empty($this->view->field[$field]->options['alter']['path'])) {
      $path = $this->view->field[$field]->options['alter']['path'];
    }
    if (!empty($title) && !empty($path)) {
      // Make sure that tokens are replaced for this paths as well.
      $tokens = $this->get_render_tokens(array());
      $path = strip_tags(decode_entities(strtr($path, $tokens)));

      $links[$field] = array(
        'href' => $path,
        'title' => $title,
      );
      if (!empty($this->options['destination'])) {
        $links[$field]['query'] = backdrop_get_destination();
      }
    }
  }
  return $links;
}