You are here

public function BulkForm::buildOptionsForm in Drupal 8

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. 10 core/modules/views/src/Plugin/views/field/BulkForm.php \Drupal\views\Plugin\views\field\BulkForm::buildOptionsForm()

Default options form that provides the label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

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

Class

BulkForm
Defines a 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);
}