You are here

function ViewsBootstrapMediaPluginStyle::options_form in Views Bootstrap 7.2

Same name and namespace in other branches
  1. 7.3 plugins/media/views_bootstrap_media_plugin_style.inc \ViewsBootstrapMediaPluginStyle::options_form()

Form.

Overrides views_plugin_style::options_form

File

plugins/media/views_bootstrap_media_plugin_style.inc, line 25
Definition of views_bootstrap_plugin_style.

Class

ViewsBootstrapMediaPluginStyle
Class to define a style plugin handler.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  if (isset($form['grouping'])) {
    $options = array();
    foreach (element_children($form['grouping']) as $key => $value) {
      if (!empty($form['grouping'][$key]['field']['#options']) && is_array($form['grouping'][$key]['field']['#options'])) {
        $options = array_merge($options, $form['grouping'][$key]['field']['#options']);
      }
    }
    $form['image_field'] = array(
      '#type' => 'select',
      '#title' => t('Image field'),
      '#options' => $options,
      '#default_value' => $this->options['image_field'],
      '#description' => t('Select the field that will be used as the image.'),
    );
    $form['heading_field'] = array(
      '#type' => 'select',
      '#title' => t('Heading field'),
      '#options' => $options,
      '#default_value' => $this->options['heading_field'],
      '#description' => t('Select the field that will be used as the heading.'),
    );
    $form['body_field'] = array(
      '#type' => 'select',
      '#title' => t('Body field'),
      '#options' => $options,
      '#default_value' => $this->options['body_field'],
      '#description' => t('Select the field that will be used as the body.'),
    );
  }
}