views_handler_field_user_revision_link_revert.inc in User Revision 7
Same filename and directory in other branches
Provide field handler to render a revert link.
File
views/views_handler_field_user_revision_link_revert.incView source
<?php
/**
* @file
* Provide field handler to render a revert link.
*/
/**
* Field handler to present a link to revert a user to a revision.
*/
class views_handler_field_user_revision_link_revert 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('revert user revisions');
}
/**
* {@inheritdoc}
*/
public function render_link($data, $values) {
if (!$this
->access()) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('revert');
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "user/" . $values->{$this->aliases['uid']} . "/revisions/" . $values->{$this->aliases['vid']} . "/revert";
$this->options['alter']['query'] = drupal_get_destination();
return $text;
}
}
Classes
Name | Description |
---|---|
views_handler_field_user_revision_link_revert | Field handler to present a link to revert a user to a revision. |