function cer_bulk_update_form_submit in Corresponding Entity References 7.3
The update form. Allows bulk updating of current entities.
File
- ./
cer.admin.inc, line 108
Code
function cer_bulk_update_form_submit(array $form, array &$form_state) {
$batch = array(
'finished' => 'cer_batch_update_existing_finished',
'title' => t('Processing'),
'init_message' => t('Preparing to update corresponding entity references for existing entities...'),
'progress_message' => t('Processing entities...'),
'error_message' => t('Corresponding entity references - existing entity update has encountered an error.'),
'operations' => array(),
);
$entity_type = $form_state['values']['type'];
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', $entity_type);
if ($entity_type == 'user') {
$query
->entityCondition('entity_id', 0, '>');
}
$result = $query
->execute();
if (isset($result[$entity_type])) {
foreach (array_keys($result[$entity_type]) as $entity_id) {
$batch['operations'][] = array(
'cer_processing_entity',
array(
'update',
$entity_id,
$entity_type,
),
);
}
}
batch_set($batch);
}