public function ContentUpdateConfirmForm::submitForm in GatherContent 8.4
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
- gathercontent_ui/
src/ Form/ ContentUpdateConfirmForm.php, line 89
Class
- ContentUpdateConfirmForm
- Provides a node deletion confirmation form.
Namespace
Drupal\gathercontent_ui\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) {
$update_options = new ImportOptions();
$update_options
->setNodeUpdateMethod($form_state
->getValue('node_update_method'));
$update_options
->setCreateNewRevision($form_state
->getValue('node_create_new_revision'));
$update_options
->setOperationUuid($operation
->uuid());
$operations[] = [
'gathercontent_import_process',
[
$node->gc_id->value,
$update_options,
],
];
}
$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);
}
}