You are here

protected function BulkForm::getBulkOptions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Plugin/views/field/BulkForm.php \Drupal\system\Plugin\views\field\BulkForm::getBulkOptions()

Returns the available operations for this form.

Parameters

bool $filtered: (optional) Whether to filter actions to selected actions.

Return value

array An associative array of operations, suitable for a select element.

2 calls to BulkForm::getBulkOptions()
BulkForm::buildOptionsForm in core/modules/system/src/Plugin/views/field/BulkForm.php
Default options form that provides the label widget that all fields should have.
BulkForm::viewsForm in core/modules/system/src/Plugin/views/field/BulkForm.php
Form constructor for the bulk form.

File

core/modules/system/src/Plugin/views/field/BulkForm.php, line 315
Contains \Drupal\system\Plugin\views\field\BulkForm.

Class

BulkForm
Defines a actions-based bulk operation form element.

Namespace

Drupal\system\Plugin\views\field

Code

protected function getBulkOptions($filtered = TRUE) {
  $options = array();

  // Filter the action list.
  foreach ($this->actions as $id => $action) {
    if ($filtered) {
      $in_selected = in_array($id, $this->options['selected_actions']);

      // If the field is configured to include only the selected actions,
      // skip actions that were not selected.
      if ($this->options['include_exclude'] == 'include' && !$in_selected) {
        continue;
      }
      elseif ($this->options['include_exclude'] == 'exclude' && $in_selected) {
        continue;
      }
    }
    $options[$id] = $action
      ->label();
  }
  return $options;
}