1 views_handler_field_bulk_form.inc | protected views_handler_field_bulk_form::get_bulk_options($filtered = TRUE) |
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.
File
- core/
modules/ views/ handlers/ views_handler_field_bulk_form.inc, line 190 - Definition of views_handler_field_bulk_form.
Class
- views_handler_field_bulk_form
- Defines a actions-based bulk operation form element.
Code
protected function get_bulk_options($filtered = TRUE) {
// Get all available actions.
$actions = actions_get_info();
$entity_type = $this->get_entity_type();
$options = array();
// Filter the action list.
foreach ($actions as $action_name => $action_info) {
if ($filtered) {
$in_selected = in_array($action_name, $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;
}
// Otherwise, if the field is configured to exclude the selected
// actions, skip actions that were selected.
elseif (($this->options['include_exclude'] == 'exclude') && $in_selected) {
continue;
}
}
// Only allow actions that are valid for this entity type.
if ($action_info['type'] == $entity_type) {
$options[$action_name] = $action_info['label'];
}
}
return $options;
}