protected function BulkForm::getBulkOptions in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/BulkForm.php \Drupal\views\Plugin\views\field\BulkForm::getBulkOptions()
- 9 core/modules/views/src/Plugin/views/field/BulkForm.php \Drupal\views\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/ views/ src/ Plugin/ views/ field/ BulkForm.php - BulkForm::viewsForm in core/
modules/ views/ src/ Plugin/ views/ field/ BulkForm.php - Form constructor for the bulk form.
File
- core/
modules/ views/ src/ Plugin/ views/ field/ BulkForm.php, line 342
Class
- BulkForm
- Defines an actions-based bulk operation form element.
Namespace
Drupal\views\Plugin\views\fieldCode
protected function getBulkOptions($filtered = TRUE) {
$options = [];
// 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;
}