You are here

views_handler_field_user_revision_link_delete.inc in User Revision 7.2

Same filename and directory in other branches
  1. 7 views/views_handler_field_user_revision_link_delete.inc

Provide field handler to render a delete link.

File

views/views_handler_field_user_revision_link_delete.inc
View source
<?php

/**
 * @file
 * Provide field handler to render a delete link.
 */

/**
 * Field handler to present a link to delete a user to a revision.
 */
class views_handler_field_user_revision_link_delete extends views_handler_field_user_link {

  /**
   * {@inheritdoc}
   */
  public function construct() {
    parent::construct();
    $this->additional_fields['uid'] = 'uid';
    $this->additional_fields['vid'] = 'vid';
  }

  /**
   * {@inheritdoc}
   */
  public function access() {
    return user_access('delete user revisions');
  }

  /**
   * {@inheritdoc}
   */
  public function render_link($data, $values) {
    if (!$this
      ->access()) {
      return;
    }
    $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = "user/" . $values->{$this->aliases['uid']} . "/revisions/" . $values->{$this->aliases['vid']} . "/delete";
    $this->options['alter']['query'] = drupal_get_destination();
    return $text;
  }

}

Classes

Namesort descending Description
views_handler_field_user_revision_link_delete Field handler to present a link to delete a user to a revision.