public function ViewsBulkOperationsAction::execute in Views Bulk Operations (VBO) 7.3
Executes the selected operation on the provided data.
Parameters
$data: The data to to operate on. An entity or an array of entities.
$context: An array of related data (selected views rows, etc).
Overrides ViewsBulkOperationsBaseOperation::execute
File
- plugins/
operation_types/ action.class.php, line 245 - Defines the class for core actions. Belongs to the "action" operation type plugin.
Class
- ViewsBulkOperationsAction
- @file Defines the class for core actions. Belongs to the "action" operation type plugin.
Code
public function execute($data, array $context) {
$context['entity_type'] = $this->entityType;
$context['settings'] = $this
->getAdminOption('settings', array());
$context += $this->formOptions;
$context += $this->operationInfo['parameters'];
// Actions provided by the Drupal system module require the entity to be
// present in $context, keyed by entity type.
if (is_object($data)) {
$context[$this->entityType] = $data;
}
actions_do($this->operationInfo['callback'], $data, $context);
// The action might need to have its entities saved after execution.
if (in_array('changes_property', $this->operationInfo['behavior'])) {
$data = is_array($data) ? $data : array(
$data,
);
foreach ($data as $entity) {
entity_save($this->entityType, $entity);
}
}
}