public function PushChangesConfirm::submitForm in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Form/PushChangesConfirm.php \Drupal\cms_content_sync\Form\PushChangesConfirm::submitForm()
- 2.0.x src/Form/PushChangesConfirm.php \Drupal\cms_content_sync\Form\PushChangesConfirm::submitForm()
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 FormInterface::submitForm
File
- src/
Form/ PushChangesConfirm.php, line 129
Class
- PushChangesConfirm
- Provides a node deletion confirmation form.
Namespace
Drupal\cms_content_sync\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('confirm')) {
$ignored = 0;
/** @var \Drupal\node\NodeInterface[] $nodes */
foreach ($this->nodes as $node) {
if (!PushIntent::pushEntityFromUi($node, PushIntent::PUSH_MANUALLY, SyncIntent::ACTION_UPDATE)) {
++$ignored;
}
}
// @todo Improve "ignore" messages (see individual "Push" operation)
\Drupal::messenger()
->addMessage(t('Pushed @count content items.', [
'@count' => count($this->nodes) - $ignored,
]));
if ($ignored) {
\Drupal::messenger()
->addWarning(t('@count content items have been ignored as they\'re not configured to be pushed.', [
'@count' => $ignored,
]));
}
$this
->logger('cms_content_sync')
->notice('Pushed @count content, ignored @ignored.', [
'@count' => count($this->nodes) - $ignored,
'@ignored' => $ignored,
]);
$this->tempStoreFactory
->get('node_cms_content_sync_push_changes_confirm')
->delete('nodes');
}
$form_state
->setRedirect('system.admin_content');
}