You are here

public function Gridstack::buildOptionsForm in DXPR GridStack 1.0.x

Same name in this branch
  1. 1.0.x src/Plugin/views/style/Gridstack.php \Drupal\dxpr_gridstack\Plugin\views\style\Gridstack::buildOptionsForm()
  2. 1.0.x src/Plugin/views/row/Gridstack.php \Drupal\dxpr_gridstack\Plugin\views\row\Gridstack::buildOptionsForm()
Same name and namespace in other branches
  1. 8 src/Plugin/views/row/Gridstack.php \Drupal\dxpr_gridstack\Plugin\views\row\Gridstack::buildOptionsForm()

Provide a form for setting options.

Overrides RowPluginBase::buildOptionsForm

File

src/Plugin/views/row/Gridstack.php, line 40

Class

Gridstack
The basic 'Gridstack' row plugin.

Namespace

Drupal\dxpr_gridstack\Plugin\views\row

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);

  // Pre-build all of our option lists for the dials and switches that follow.
  $fields = [];
  foreach ($this->displayHandler
    ->getHandlers('field') as $field => $handler) {
    $fields[$field] = $field;
  }
  $form['image'] = [
    '#type' => 'select',
    '#required' => TRUE,
    '#title' => t('Image'),
    '#options' => [
      '' => t('- None -'),
    ] + $fields,
    '#default_value' => $this->options['image'],
  ];
  $form['title'] = [
    '#type' => 'select',
    '#title' => t('Title'),
    '#options' => [
      '' => t('- None -'),
    ] + $fields,
    '#default_value' => $this->options['title'],
  ];
  $form['category'] = [
    '#type' => 'select',
    '#title' => t('Category'),
    '#options' => [
      '' => t('- None -'),
    ] + $fields,
    '#default_value' => $this->options['category'],
  ];
}