public function DeleteTermsConfirm::submitForm in Taxonomy Multi-delete Terms 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/ DeleteTermsConfirm.php, line 173
Class
- DeleteTermsConfirm
- Defines a confirmation form for deleting term data.
Namespace
Drupal\taxonomy_multidelete_terms\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$selected_terms = array_filter($form_state
->getValue('terms'));
if ($form_state
->getValue('terms') === 'cancel') {
$this
->deleteStore();
}
$batch = [
'title' => t('Deleting Terms...'),
'operations' => [
[
'\\Drupal\\taxonomy_multidelete_terms\\TaxonomyMultideleteBatch::processTerms',
[
$selected_terms,
],
],
],
'finished' => '\\Drupal\\taxonomy_multidelete_terms\\TaxonomyMultideleteBatch::finishProcess',
];
batch_set($batch);
$form_state
->setRedirectUrl($this
->getRedirectUrl());
}