commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / redirect / views / redirect_handler_field_redirect_link_delete.inc
1 <?php
2
3 /**
4 * @file
5 * Redirect field handler for edit links.
6 */
7
8 class redirect_handler_field_redirect_link_delete extends views_handler_field {
9 function construct() {
10 parent::construct();
11 $this->additional_fields['rid'] = 'rid';
12 }
13
14 function option_definition() {
15 $options = parent::option_definition();
16 $options['text'] = array('default' => '', 'translatable' => TRUE);
17 return $options;
18 }
19
20 function options_form(&$form, &$form_state) {
21 parent::options_form($form, $form_state);
22 $form['text'] = array(
23 '#type' => 'textfield',
24 '#title' => t('Text to display'),
25 '#default_value' => $this->options['text'],
26 );
27 }
28
29 function query() {
30 $this->ensure_my_table();
31 $this->add_additional_fields();
32 }
33
34 function render($values) {
35 $rid = $values->{$this->aliases['rid']};
36 if (($redirect = redirect_load($rid)) && redirect_access('delete', $redirect)) {
37 $text = !empty($this->options['text']) ? $this->options['text'] : t('Delete');
38 return l($text, "admin/config/search/redirect/delete/" . $rid, array('query' => drupal_get_destination()));
39 }
40 }
41 }