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

handlers/views_handler_area.inc

Go to the documentation of this file.
00001 <?php
00014 class views_handler_area extends views_handler {
00018   function label() {
00019     if (!isset($this->options['label'])) {
00020       return $this->ui_name();
00021     }
00022     return $this->options['label'];
00023   }
00024 
00025   function option_definition() {
00026     $options = parent::option_definition();
00027 
00028     $this->definition['field'] = !empty($this->definition['field']) ? $this->definition['field'] : '';
00029     $label = !empty($this->definition['label']) ? $this->definition['label'] : $this->definition['field'];
00030     $options['label'] = array('default' => $label, 'translatable' => TRUE);
00031     $options['empty'] = array('default' => 0, 'bool' => TRUE);
00032 
00033     return $options;
00034   }
00035 
00039   function admin_summary() {
00040     return $this->label();
00041   }
00042 
00047   function options_form(&$form, &$form_state) {
00048     parent::options_form($form, $form_state);
00049     $form['label'] = array(
00050       '#type' => 'textfield',
00051       '#title' => t('Label'),
00052       '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
00053       '#description' => t('The label for this area that will be displayed only administratively.'),
00054     );
00055 
00056     if ($form_state['type'] != 'empty') {
00057       $form['empty'] = array(
00058         '#type' => 'checkbox',
00059         '#title' => t('Display even if view has no result'),
00060         '#default_value' => isset($this->options['empty']) ? $this->options['empty'] : 0,
00061       );
00062     }
00063   }
00064 
00068   function query() { }
00069 
00073   function render($empty = FALSE) {
00074     return '';
00075   }
00076 
00080   function use_group_by() {
00081     return FALSE;
00082   }
00083 }
00084 
00090 class views_handler_area_broken extends views_handler_area {
00091   function ui_name($short = FALSE) {
00092     return t('Broken/missing handler');
00093   }
00094 
00095   function ensure_my_table() { /* No table to ensure! */ }
00096   function query($group_by = FALSE) { /* No query to run */ }
00097   function render($empty = FALSE) { return ''; }
00098   function options_form(&$form, &$form_state) {
00099     $form['markup'] = array(
00100       '#prefix' => '<div class="form-item description">',
00101       '#value' => t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.'),
00102     );
00103   }
00104 
00108   function broken() { return TRUE; }
00109 }
00110 

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