You are here

class views_plugin_style_fixed_grid in Views Fixed Grid 6

Same name and namespace in other branches
  1. 7 views_plugin_style_fixed_grid.inc \views_plugin_style_fixed_grid

@file views_plugin_style_fixed_grid.inc Implementation of views_plugin_style

In this case we only need the configuration form. All the other logic will be handled by the preprocess function

Hierarchy

Expanded class hierarchy of views_plugin_style_fixed_grid

1 string reference to 'views_plugin_style_fixed_grid'
views_fixed_grid_views_plugins in ./views_fixed_grid.views.inc
Implements of hook_views_plugins().

File

./views_plugin_style_fixed_grid.inc, line 10
views_plugin_style_fixed_grid.inc Implementation of views_plugin_style

View source
class views_plugin_style_fixed_grid extends views_plugin_style_grid {

  /**
   * Set default options
   */
  function options(&$options) {
    $options['alignment'] = 'random';
    $options['rows'] = 6;
    $options['columns'] = 7;
    $options['maxitems'] = NULL;
  }

  /**
   * Define options.
   */
  function option_definition() {
    $options = parent::option_definition();
    $options['alignment'] = array(
      'default' => 'random',
    );
    $options['rows'] = array(
      'default' => '6',
    );
    $options['columns'] = array(
      'default' => '7',
    );
    $options['maxitems'] = array(
      'default' => NULL,
    );
    return $options;
  }

  /**
   * Provide a form for setting options.
   *
   * @param array $form
   * @param array $form_state
   */
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    unset($form['fill_single_line']);
    $form['rows'] = array(
      '#type' => 'textfield',
      '#title' => t('Number of rows'),
      '#description' => t('Select the number of rows.'),
      '#default_value' => $this->options['rows'],
      '#required' => TRUE,
      '#weight' => -1,
    );
    $form['columns']['#required'] = TRUE;
    $form['columns']['#weight'] = -1;
    $form['maxitems'] = array(
      '#type' => 'textfield',
      '#title' => t('Maximum numbers of items'),
      '#description' => t('If you want to always have some empty space select the maximum number of items. Leave it empty to not to have a maximum.'),
      '#default_value' => $this->options['maxitems'],
    );
    $form['alignment']['#options']['random'] = t('Random');
  }

}

Members