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

handlers/views_handler_field_custom.inc

00001 <?php
00002 
00008 class views_handler_field_custom extends views_handler_field {
00009   function query() {
00010     // do nothing -- to override the parent query.
00011   }
00012 
00013   function option_definition() {
00014     $options = parent::option_definition();
00015 
00016     // Override the alter text option to always alter the text.
00017     $options['alter']['contains']['alter_text'] = array('default' => TRUE);
00018     $options['hide_alter_empty'] = array('default' => FALSE);
00019     return $options;
00020   }
00021 
00022   function options_form(&$form, &$form_state) {
00023     parent::options_form($form, $form_state);
00024 
00025     // Remove the checkbox
00026     unset($form['alter']['alter_text']);
00027     unset($form['alter']['text']['#dependency']);
00028     unset($form['alter']['text']['#process']);
00029     unset($form['alter']['help']['#dependency']);
00030     unset($form['alter']['help']['#process']);
00031     $form['#pre_render'][] = 'views_handler_field_custom_pre_render_move_text';
00032   }
00033 
00034   function render($values) {
00035     // Return the text, so the code never thinks the value is empty.
00036     return $this->options['alter']['text'];
00037   }
00038 }
00039 
00043 function views_handler_field_custom_pre_render_move_text($form) {
00044   $form['text'] = $form['alter']['text'];
00045   $form['help'] = $form['alter']['help'];
00046   unset($form['alter']['text']);
00047   unset($form['alter']['help']);
00048 
00049   return $form;
00050 }

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