You are here

public function FieldDeleteForm::buildForm in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Form/FieldDeleteForm.php \Drupal\ds\Form\FieldDeleteForm::buildForm()
  2. 8.3 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\Form

Code

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)) {
    drupal_set_message($this
      ->t('Field not found.'));
    return new RedirectResponse('/admin/structure/ds/fields');
  }
  return parent::buildForm($form, $form_state, $request);
}