123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
- class views_handler_area extends views_handler {
-
- function init(&$view, &$options) {
- parent::init($view, $options);
- if ($this->handler_type == 'empty') {
- $this->options['empty'] = TRUE;
- }
- }
-
- function label() {
- if (!isset($this->options['label'])) {
- return $this->ui_name();
- }
- return $this->options['label'];
- }
- function option_definition() {
- $options = parent::option_definition();
- $this->definition['field'] = !empty($this->definition['field']) ? $this->definition['field'] : '';
- $label = !empty($this->definition['label']) ? $this->definition['label'] : $this->definition['field'];
- $options['label'] = array('default' => $label, 'translatable' => TRUE);
- $options['empty'] = array('default' => FALSE, 'bool' => TRUE);
- return $options;
- }
-
- function admin_summary() {
- return $this->label();
- }
-
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
- $form['label'] = array(
- '#type' => 'textfield',
- '#title' => t('Label'),
- '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
- '#description' => t('The label for this area that will be displayed only administratively.'),
- );
- if ($form_state['type'] != 'empty') {
- $form['empty'] = array(
- '#type' => 'checkbox',
- '#title' => t('Display even if view has no result'),
- '#default_value' => isset($this->options['empty']) ? $this->options['empty'] : 0,
- );
- }
- }
-
- function query() { }
-
- function render($empty = FALSE) {
- return '';
- }
-
- function use_group_by() {
- return FALSE;
- }
- }
- class views_handler_area_broken extends views_handler_area {
- function ui_name($short = FALSE) {
- return t('Broken/missing handler');
- }
- function ensure_my_table() { }
- function query($group_by = FALSE) { }
- function render($empty = FALSE) { return ''; }
- function options_form(&$form, &$form_state) {
- $form['markup'] = array(
- '#prefix' => '<div class="form-item description">',
- '#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.'),
- );
- }
-
- function broken() { return TRUE; }
- }
|