You are here

function views_handler_field_term_link_edit::render_link in Views (for Drupal 7) 7.3

1 call to views_handler_field_term_link_edit::render_link()
views_handler_field_term_link_edit::render in modules/taxonomy/views_handler_field_term_link_edit.inc
Render the field.

File

modules/taxonomy/views_handler_field_term_link_edit.inc, line 70
Definition of views_handler_field_term_link_edit.

Class

views_handler_field_term_link_edit
Field handler to present a term edit link.

Code

function render_link($data, $values) {

  // Mock a term object for taxonomy_term_edit_access(). Use machine name and
  // vid to ensure compatibility with vid based and machine name based
  // access checks. See http://drupal.org/node/995156
  $term = new stdClass();
  $term->vid = $values->{$this->aliases['vid']};
  $term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']};
  if ($data && taxonomy_term_edit_access($term)) {
    $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = "taxonomy/term/{$data}/edit";
    $this->options['alter']['query'] = drupal_get_destination();
    return $text;
  }
}