public function ContentUpdateConfirmForm::submitForm in GatherContent 8.3
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ContentConfirmForm::submitForm
File
- src/
Form/ ContentUpdateConfirmForm.php, line 76
Class
- ContentUpdateConfirmForm
- Provides a node deletion confirmation form.
Namespace
Drupal\gathercontent\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('confirm') && !empty($this->nodeIds)) {
$operation = Operation::create([
'type' => 'update',
]);
$operation
->save();
$nodes = Node::loadMultiple($this->nodeIds);
$operations = [];
foreach ($nodes as $node) {
$gc_id = $node->gc_id->value;
$operations[] = [
'gathercontent_update_process',
[
$gc_id,
$operation
->uuid(),
$form_state
->getValue('node_update_method'),
],
];
}
$batch = [
'title' => t('Updating content ...'),
'operations' => $operations,
'finished' => 'gathercontent_update_finished',
'init_message' => t('Update is starting ...'),
'progress_message' => t('Processed @current out of @total.'),
'error_message' => t('An error occurred during processing'),
];
$this->tempStore
->delete('nodes');
batch_set($batch);
}
}