You are here

public function BulkForm::buildOptionsForm in Drupal 10

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

File

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

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);
}