public function RuleDeleteConfirmForm::submitForm in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_user_sync/src/Form/RuleDeleteConfirmForm.php \Drupal\crm_core_user_sync\Form\RuleDeleteConfirmForm::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
- modules/
crm_core_user_sync/ src/ Form/ RuleDeleteConfirmForm.php, line 46
Class
- RuleDeleteConfirmForm
- Provides a confirmation form before clearing out the examples.
Namespace
Drupal\crm_core_user_sync\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$rule_key = $this
->getRequest()
->get('rule_key');
$rules = $this
->configFactory()
->getEditable('crm_core_user_sync.settings')
->get('rules');
unset($rules[$rule_key]);
// Re-key.
$rules = array_values($rules);
$this
->configFactory()
->getEditable('crm_core_user_sync.settings')
->set('rules', $rules)
->save();
$this
->messenger()
->addMessage('Rule was deleted');
$form_state
->setRedirectUrl($this
->getCancelUrl());
}