public function FieldDeleteForm::buildForm in Display Suite 8.3
Same name and namespace in other branches
- 8.4 src/Form/FieldDeleteForm.php \Drupal\ds\Form\FieldDeleteForm::buildForm()
- 8.2 src/Form/FieldDeleteForm.php \Drupal\ds\Form\FieldDeleteForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfirmFormBase::buildForm
File
- src/
Form/ FieldDeleteForm.php, line 77
Class
- FieldDeleteForm
- Provides a form to delete a DS field.
Namespace
Drupal\ds\FormCode
public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $field_key = '') {
$config = $this
->config('ds.field.' . $field_key);
$this->field = $config
->get();
if (empty($this->field)) {
$this
->messenger()
->addMessage($this
->t('Field not found.'));
return new RedirectResponse('/admin/structure/ds/fields');
}
return parent::buildForm($form, $form_state);
}