function BulkForm::buildOptionsForm

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/BulkForm.php \Drupal\views\Plugin\views\field\BulkForm::buildOptionsForm()
  2. 8.9.x core/modules/views/src/Plugin/views/field/BulkForm.php \Drupal\views\Plugin\views\field\BulkForm::buildOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/field/BulkForm.php \Drupal\views\Plugin\views\field\BulkForm::buildOptionsForm()

Default option form that provides label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/field/BulkForm.php, line 230

Class

BulkForm
Defines an actions-based bulk operation form element.

Namespace

Drupal\views\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $form['action_title'] = [
    '#type' => 'textfield',
    '#title' => $this->t('Action title'),
    '#default_value' => $this->options['action_title'],
    '#description' => $this->t('The title shown above the actions dropdown.'),
  ];
  $form['include_exclude'] = [
    '#type' => 'radios',
    '#title' => $this->t('Available actions'),
    '#options' => [
      'exclude' => $this->t('All actions, except selected'),
      'include' => $this->t('Only selected actions'),
    ],
    '#default_value' => $this->options['include_exclude'],
  ];
  $form['selected_actions'] = [
    '#type' => 'checkboxes',
    '#title' => $this->t('Selected actions'),
    '#options' => $this->getBulkOptions(FALSE),
    '#default_value' => $this->options['selected_actions'],
  ];
  parent::buildOptionsForm($form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.