You are here

public function GroupDeleteForm::buildForm in Context groups 8

Same name and namespace in other branches
  1. 8.2 src/Form/GroupDeleteForm.php \Drupal\context_groups\Form\GroupDeleteForm::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/GroupDeleteForm.php, line 97

Class

GroupDeleteForm
Class GroupDeleteForm.

Namespace

Drupal\context_groups\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $context = NULL, $context_group = NULL) {
  $this->context = $this->entityTypeManager
    ->getStorage('context')
    ->load($context);
  $group = $this->context
    ->getThirdPartySetting('context_groups', $context_group);
  $this->contextGroup = $group;
  $form = parent::buildForm($form, $form_state);

  // Submit the form with AJAX if possible.
  $form['actions']['submit']['#ajax'] = [
    'callback' => '::submitFormAjax',
  ];
  return $form;
}