[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

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

   1  <?php
   2  // $Id: views_plugin_style_grid.inc,v 1.1.4.1 2010/06/16 19:18:24 merlinofchaos Exp $
   3  /**
   4   * @file
   5   * Contains the grid style plugin.
   6   */
   7  
   8  /**
   9   * Style plugin to render each item in a grid cell.
  10   *
  11   * @ingroup views_style_plugins
  12   */
  13  class views_plugin_style_grid extends views_plugin_style {
  14    /**
  15     * Set default options
  16     */
  17    function option_definition() {
  18      $options = parent::option_definition();
  19  
  20      $options['columns'] = array('default' => '4');
  21      $options['alignment'] = array('default' => 'horizontal');
  22      $options['fill_single_line'] = array('default' => TRUE);
  23  
  24      return $options;
  25    }
  26  
  27    /**
  28     * Render the given style.
  29     */
  30    function options_form(&$form, &$form_state) {
  31      parent::options_form($form, $form_state);
  32      $form['columns'] = array(
  33        '#type' => 'textfield',
  34        '#title' => t('Number of columns'),
  35        '#default_value' => $this->options['columns'],
  36      );
  37      $form['alignment'] = array(
  38        '#type' => 'radios',
  39        '#title' => t('Alignment'),
  40        '#options' => array('horizontal' => t('Horizontal'), 'vertical' => t('Vertical')),
  41        '#default_value' => $this->options['alignment'],
  42        '#description' => t('Horizontal alignment will place items starting in the upper left and moving right. Vertical alignment will place items starting in the upper left and moving down.'),
  43      );
  44      
  45      $form['fill_single_line'] = array(
  46        '#type' => 'checkbox',
  47        '#title' => t('Fill up single line'),
  48        '#description' => t('If you disable this option a grid with only one row will have the amount of items as tds. If you disable it this can cause problems with your css.'),
  49        '#default_value' => !empty($this->options['fill_single_line']),
  50      );
  51    }
  52  }
  53  


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