[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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

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


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7