public function CandidateNodesForm::submitForm in Node Revision Delete 8
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/ CandidateNodesForm.php, line 206
Class
- CandidateNodesForm
- Class CandidateNodesForm.
Namespace
Drupal\node_revision_delete\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Get selected candidate nodes.
$nids = array_filter($form_state
->getValue('candidate_nodes'));
if (count($nids)) {
// Get selected node's candidate revisions from form_state to delete.
$candidate_revisions = [];
$candidate_revisions_by_nid = array_intersect_key($form_state
->get('candidate_revisions'), $nids);
foreach ($candidate_revisions_by_nid as $nid => $revisions) {
$candidate_revisions = array_merge($candidate_revisions, $revisions);
}
// Add the batch.
batch_set($this->nodeRevisionDelete
->getRevisionDeletionBatch($candidate_revisions, FALSE));
}
}