[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/views/plugins/ -> views_plugin_row_fields.inc (source)

   1  <?php
   2  // $Id: views_plugin_row_fields.inc,v 1.2.2.1 2010/03/11 00:06:18 merlinofchaos Exp $
   3  /**
   4   * @file
   5   * Contains the base row style plugin.
   6   */
   7  
   8  /**
   9   * The basic 'fields' row plugin
  10   *
  11   * This displays fields one after another, giving options for inline
  12   * or not.
  13   *
  14   * @ingroup views_row_plugins
  15   */
  16  class views_plugin_row_fields extends views_plugin_row {
  17    function option_definition() {
  18      $options = parent::option_definition();
  19  
  20      $options['inline'] = array('default' => array());
  21      $options['separator'] = array('default' => '');
  22      $options['hide_empty'] = array('default' => FALSE);
  23      return $options;
  24    }
  25  
  26    /**
  27     * Provide a form for setting options.
  28     */
  29    function options_form(&$form, &$form_state) {
  30      $options = $this->display->handler->get_field_labels();
  31  
  32      if (empty($this->options['inline'])) {
  33        $this->options['inline'] = array();
  34      }
  35  
  36      $form['inline'] = array(
  37        '#type' => 'checkboxes',
  38        '#title' => t('Inline fields'),
  39        '#options' => $options,
  40        '#default_value' => $this->options['inline'],
  41        '#description' => t('Inline fields will be displayed next to each other rather than one after another.'),
  42      );
  43  
  44      $form['separator'] = array(
  45        '#title' => t('Separator'),
  46        '#type' => 'textfield',
  47        '#size' => 10,
  48        '#default_value' => isset($this->options['separator']) ? $this->options['separator'] : '',
  49        '#description' => t('The separator may be placed between inline fields to keep them from squishing up next to each other. You can use HTML in this field.'),
  50      );
  51  
  52      $form['hide_empty'] = array(
  53        '#type' => 'checkbox',
  54        '#title' => t('Hide empty fields'),
  55        '#default_value' => $this->options['hide_empty'],
  56        '#description' => t('Do not display fields, labels or markup for fields that are empty.'),
  57      );
  58    }
  59  
  60    /**
  61     * Perform any necessary changes to the form values prior to storage.
  62     * There is no need for this function to actually store the data.
  63     */
  64    function options_submit($form, &$form_state) {
  65      $form_state['values']['row_options']['inline'] = array_filter($form_state['values']['row_options']['inline']);
  66    }
  67  }
  68  


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7