You are here

public function ContextDisableForm::buildForm in Context 8

Same name and namespace in other branches
  1. 8.4 modules/context_ui/src/Form/ContextDisableForm.php \Drupal\context_ui\Form\ContextDisableForm::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 EntityConfirmFormBase::buildForm

File

modules/context_ui/src/Form/ContextDisableForm.php, line 64

Class

ContextDisableForm

Namespace

Drupal\context_ui\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);

  // Remove the cancel button if this is an AJAX request since Drupals built
  // in modal dialogues does not handle buttons that are not a primary
  // button very well.
  if ($this
    ->getRequest()
    ->isXmlHttpRequest()) {
    unset($form['actions']['cancel']);
  }
  return $form;
}