You are here

function views_foundation_plugin_row_pricing_tables::options_form in Views Foundation 7

Same name and namespace in other branches
  1. 7.4 view/views_foundation_plugin_row_pricing_tables.inc \views_foundation_plugin_row_pricing_tables::options_form()

Provide a form for setting options.

Overrides views_plugin_row::options_form

File

view/views_foundation_plugin_row_pricing_tables.inc, line 34
Views Foundation Pricing Tables row style plugin.

Class

views_foundation_plugin_row_pricing_tables
Row plugin to render fields in a pricing tables.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Pre-build all of option lists for the select fields.
  $fields = array(
    '' => t('<none>'),
  );
  foreach ($this->display->handler
    ->get_handlers('field') as $field => $handler) {
    if ($label = $handler
      ->label()) {
      $fields[$field] = $handler
        ->label() . ': ' . $handler->options['settings']['image_style'];
    }
    else {
      $fields[$field] = $handler
        ->ui_name();
    }
  }
  $form['title_field'] = array(
    '#type' => 'select',
    '#title' => t('Title field'),
    '#options' => $fields,
    '#default_value' => $this->options['title_field'],
    '#description' => t('Select the field that will be used as the title.'),
  );
  $form['price_field'] = array(
    '#type' => 'select',
    '#title' => t('Price field'),
    '#options' => $fields,
    '#default_value' => $this->options['price_field'],
    '#description' => t('Select the field that will be used as the price.'),
  );
  $form['description_field'] = array(
    '#type' => 'select',
    '#title' => t('Description field'),
    '#options' => $fields,
    '#default_value' => $this->options['description_field'],
    '#description' => t('Select the field that will be used as the description.'),
  );
  $form['button_field'] = array(
    '#type' => 'select',
    '#title' => t('Button field'),
    '#options' => $fields,
    '#default_value' => $this->options['button_field'],
    '#description' => t('Select the field that will be used as the button.'),
  );
}