You are here

public function ParserOperationForm::buildForm in Markdown 8.2

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/ParserOperationForm.php, line 153

Class

ParserOperationForm
Provides a confirmation form to disable a parser.

Namespace

Drupal\markdown\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, ParserInterface $parser = NULL, $operation = NULL) {
  $this
    ->initializeOperation($parser, $operation);
  $form = parent::buildForm($form, $form_state);

  // Allow the cancel button to simply close the dialog.
  if (!empty(\Drupal::request()
    ->get('_drupal_ajax'))) {
    $form['actions']['cancel']['#attributes']['class'][] = 'dialog-cancel';
  }
  return $form;
}