function state_flow_node_revision_operation_change_state in State Machine 7.2
Same name and namespace in other branches
- 7.3 modules/state_flow/state_flow.module \state_flow_node_revision_operation_change_state()
Operation callback to change state of a node
1 string reference to 'state_flow_node_revision_operation_change_state'
- state_flow_node_revision_operations in modules/
state_flow/ state_flow.module - Implements hook_node_revision_operations().
File
- modules/
state_flow/ state_flow.module, line 659 - An implementation of node revision workflow for Drupal based on the State Machine system.
Code
function state_flow_node_revision_operation_change_state($nodes, $args) {
$event = $args['event'];
// We use batch processing to prevent timeout when updating a large number
// of nodes.
if (count($nodes) > 10) {
$batch = array(
'operations' => array(
array(
'state_flow_node_revision_operation_change_state_batch_process',
array(
$nodes,
$args,
),
),
),
'finished' => 'state_flow_node_revision_operation_change_state_batch_finished',
'title' => t('Processing'),
// We use a single multi-pass operation, so the default
// 'Remaining x of y operations' message will be confusing here.
'progress_message' => '',
'error_message' => t('The update has encountered an error.'),
);
batch_set($batch);
}
else {
$message = array();
foreach ($nodes as $info) {
$messages[] = state_flow_operation_change_helper($info, $event);
}
$message = theme('item_list', array(
'items' => $messages,
));
$message = format_plural(count($nodes), '1 item successfully processed:', '@count items successfully processed:');
drupal_set_message($message);
}
}