public function ConditionalFieldDeleteForm::submitForm in Conditional Fields 8
Same name and namespace in other branches
- 4.x src/Form/ConditionalFieldDeleteForm.php \Drupal\conditional_fields\Form\ConditionalFieldDeleteForm::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
1 call to ConditionalFieldDeleteForm::submitForm()
- ConditionalFieldDeleteFormTab::submitForm in src/
Form/ ConditionalFieldDeleteFormTab.php - Form submission handler.
1 method overrides ConditionalFieldDeleteForm::submitForm()
- ConditionalFieldDeleteFormTab::submitForm in src/
Form/ ConditionalFieldDeleteFormTab.php - Form submission handler.
File
- src/
Form/ ConditionalFieldDeleteForm.php, line 52
Class
- ConditionalFieldDeleteForm
- Class ConditionalFieldDeleteForm.
Namespace
Drupal\conditional_fields\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if (empty($this->entityType) || empty($this->bundle) || empty($this->fieldName) || empty($this->uuid)) {
return;
}
/**
* @var EntityFormDisplay $entity
*/
$entity = \Drupal::entityTypeManager()
->getStorage('entity_form_display')
->load($this->entityType . '.' . $this->bundle . '.default');
if (!$entity) {
return;
}
$field = $entity
->getComponent($this->fieldName);
unset($field['third_party_settings']['conditional_fields'][$this->uuid]);
$entity
->setComponent($this->fieldName, $field);
$entity
->save();
$form_state
->setRedirectUrl($this
->getCancelUrl());
}