You are here

function views_limit_grouping_style_plugin::options_form in Views Grouping Row Limit 7

Same name and namespace in other branches
  1. 6 views_limit_grouping_style_plugin.inc \views_limit_grouping_style_plugin::options_form()

Overrides parent::options_form().

Add our options to the form.

Overrides views_plugin_style::options_form

File

./views_limit_grouping_style_plugin.inc, line 15
views_grouping_limit_style_plugin.inc Our handler.

Class

views_limit_grouping_style_plugin
@file views_grouping_limit_style_plugin.inc Our handler.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  foreach ($form['grouping'] as $index => $info) {
    $defaults = $this
      ->grouping_limit_settings($index);
    $form['grouping'][$index]['grouping-limit'] = array(
      '#type' => 'fieldset',
      '#title' => t('Limit for grouping field Nr.!num', array(
        '!num' => $index + 1,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#states' => array(
        'invisible' => array(
          "select[name=\"style_options[grouping][{$index}][field]\"]" => array(
            'value' => '',
          ),
        ),
      ),
      'grouping-limit' => array(
        '#type' => 'textfield',
        '#title' => t('Items to display:'),
        '#default_value' => isset($defaults['grouping-limit']) ? $defaults['grouping-limit'] : 0,
        '#size' => 6,
        '#element_validate' => array(
          'grouping_validate',
        ),
        '#description' => t('The number of rows to show under each grouping header (only works when "Items to display" in the main view is set to unlimited).'),
      ),
      'grouping-offset' => array(
        '#type' => 'textfield',
        '#title' => t('Offset:'),
        '#default_value' => isset($defaults['grouping-offset']) ? $defaults['grouping-offset'] : 0,
        '#size' => 6,
        '#element_validate' => array(
          'grouping_validate',
        ),
        '#description' => t('The row to start on (<em>0</em> means it will start with first row, <em>1</em> means an offset of 1, and so on).'),
      ),
    );
  }
}