Implements \Drupal\system\Plugin\views\field\BulkFormBase::getBulkOptions().
bool $filtered: (optional) Whether to filter actions to selected actions.
Overrides BulkFormBase::getBulkOptions
protected function getBulkOptions($filtered = TRUE) {
// Get all available actions.
$entity_type = $this
->getEntityType();
$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;
}
}
// Only allow actions that are valid for this entity type.
if ($action
->getType() == $entity_type) {
$options[$id] = $action
->label();
}
}
return $options;
}