function cer_update_form_submit in Corresponding Entity References 7.2
Same name and namespace in other branches
- 7 cer.admin.inc \cer_update_form_submit()
The update form. Allows updating of current entitys.
File
- ./
cer.admin.inc, line 132 - Administrative functionality, separated for performance purposes.
Code
function cer_update_form_submit($form, &$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.'),
);
$entity_type = $form_state['values']['type'];
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', $entity_type);
$result = $query
->execute();
if (isset($result[$entity_type])) {
foreach ($result[$entity_type] as $entity_id => $stub) {
$batch['operations'][] = array(
'cer_processing_entity',
array(
'update',
$entity_id,
$entity_type,
),
);
}
}
batch_set($batch);
}