public function FormManglerService::handleFormSubmit in Rabbit Hole 2.x
Same name and namespace in other branches
- 8 src/FormManglerService.php \Drupal\rabbit_hole\FormManglerService::handleFormSubmit()
Handle general aspects of rabbit hole form submission.
(Not specific to node etc.).
Parameters
array $form: The form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
File
- src/
FormManglerService.php, line 381
Class
- FormManglerService
- Provides necessary form alterations.
Namespace
Drupal\rabbit_holeCode
public function handleFormSubmit(array $form, FormStateInterface $form_state) {
if ($form_state
->getValue('rh_is_bundle')) {
$entity = NULL;
if (method_exists($form_state
->getFormObject(), 'getEntity')) {
$entity = $form_state
->getFormObject()
->getEntity();
}
$allow_override = $form_state
->getValue('rh_override') ? BehaviorSettings::OVERRIDE_ALLOW : BehaviorSettings::OVERRIDE_DISALLOW;
$this->rhBehaviorSettingsManager
->saveBehaviorSettings([
'action' => $form_state
->getValue('rh_action'),
'allow_override' => $allow_override,
'redirect' => $form_state
->getValue('rh_redirect') ?: '',
'redirect_code' => $form_state
->getValue('rh_redirect_response') ?: BehaviorSettings::REDIRECT_NOT_APPLICABLE,
'redirect_fallback_action' => $form_state
->getvalue('rh_redirect_fallback_action') ?: 'access_denied',
], $form_state
->getValue('rh_entity_type'), isset($entity) ? $entity
->id() : NULL);
}
}