You are here

function views_plugin_style::options_form in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_style.inc \views_plugin_style::options_form()
  2. 7.3 plugins/views_plugin_style.inc \views_plugin_style::options_form()

Provide a form to edit options for this plugin.

Overrides views_plugin::options_form

7 calls to views_plugin_style::options_form()
views_plugin_style_default::options_form in plugins/views_plugin_style_default.inc
Provide a form to edit options for this plugin.
views_plugin_style_grid::options_form in plugins/views_plugin_style_grid.inc
Render the given style.
views_plugin_style_jump_menu::options_form in plugins/views_plugin_style_jump_menu.inc
Render the given style.
views_plugin_style_list::options_form in plugins/views_plugin_style_list.inc
Render the given style.
views_plugin_style_rss::options_form in plugins/views_plugin_style_rss.inc
Provide a form to edit options for this plugin.

... See full list

8 methods override views_plugin_style::options_form()
views_plugin_style_default::options_form in plugins/views_plugin_style_default.inc
Provide a form to edit options for this plugin.
views_plugin_style_grid::options_form in plugins/views_plugin_style_grid.inc
Render the given style.
views_plugin_style_jump_menu::options_form in plugins/views_plugin_style_jump_menu.inc
Render the given style.
views_plugin_style_list::options_form in plugins/views_plugin_style_list.inc
Render the given style.
views_plugin_style_rss::options_form in plugins/views_plugin_style_rss.inc
Provide a form to edit options for this plugin.

... See full list

File

plugins/views_plugin_style.inc, line 167

Class

views_plugin_style
Base class to define a style plugin handler.

Code

function options_form(&$form, &$form_state) {

  // Only fields-based views can handle grouping.  Style plugins can also exclude
  // themselves from being groupable by setting their "use grouping" definiton
  // key to FALSE.
  // @TODO: Document "uses grouping" in docs.php when docs.php is written.
  if ($this
    ->uses_fields() && $this->definition['uses grouping']) {
    $options = array(
      '' => t('- None -'),
    );
    $options += $this->display->handler
      ->get_field_labels();

    // If there are no fields, we can't group on them.
    if (count($options) > 1) {
      $form['grouping'] = array(
        '#type' => 'select',
        '#title' => t('Grouping field'),
        '#options' => $options,
        '#default_value' => $this->options['grouping'],
        '#description' => t('You may optionally specify a field by which to group the records. Leave blank to not group.'),
      );
    }
  }
  if ($this
    ->uses_row_class()) {
    $form['row_class'] = array(
      '#title' => t('Row class'),
      '#description' => t('The class to provide on each row.'),
      '#type' => 'textfield',
      '#default_value' => $this->options['row_class'],
    );
    if ($this
      ->uses_fields()) {
      $form['row_class']['#description'] .= ' ' . t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.');
    }
  }
}