• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

modules/locale/views_handler_field_locale_link_edit.inc

00001 <?php
00002 
00008 class views_handler_field_locale_link_edit extends views_handler_field {
00009   function construct() {
00010     parent::construct();
00011     $this->additional_fields['lid'] = 'lid';
00012   }
00013 
00014   function option_definition() {
00015     $options = parent::option_definition();
00016 
00017     $options['text'] = array('default' => '', 'translatable' => TRUE);
00018 
00019     return $options;
00020   }
00021 
00022   function options_form(&$form, &$form_state) {
00023     $form['text'] = array(
00024       '#type' => 'textfield',
00025       '#title' => t('Text to display'),
00026       '#default_value' => $this->options['text'],
00027     );
00028     parent::options_form($form, $form_state);
00029   }
00030 
00031   function query() {
00032     $this->ensure_my_table();
00033     $this->add_additional_fields();
00034   }
00035 
00036   function access() {
00037     // Ensure user has access to edit translations.
00038     return user_access('translate interface');
00039   }
00040 
00041   function render($values) {
00042     $value = $this->get_value($values, 'lid');
00043     return $this->render_link($this->sanitize_value($value), $values);
00044   }
00045 
00046   function render_link($data, $values) {
00047     $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
00048 
00049     $this->options['alter']['make_link'] = TRUE;
00050     $this->options['alter']['path'] = 'admin/build/translate/edit/' . $data;
00051     $this->options['alter']['query'] = drupal_get_destination();
00052 
00053     return $text;
00054   }
00055 }

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1