You are here

public function GeysirModalParagraphForm::buildForm in Geysir 8

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 EntityForm::buildForm

1 call to GeysirModalParagraphForm::buildForm()
GeysirModalParagraphAddForm::buildForm in src/Form/GeysirModalParagraphAddForm.php
Form constructor.
1 method overrides GeysirModalParagraphForm::buildForm()
GeysirModalParagraphAddForm::buildForm in src/Form/GeysirModalParagraphAddForm.php
Form constructor.

File

src/Form/GeysirModalParagraphForm.php, line 34

Class

GeysirModalParagraphForm
Functionality to edit a paragraph through a modal.

Namespace

Drupal\geysir\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $form['#prefix'] = '<div id="geysir-modal-form">';
  $form['#suffix'] = '</div>';

  // @TODO: fix problem with form is outdated.
  $form['#token'] = FALSE;

  // Define alternative submit callbacks using AJAX by copying the default
  // submit callbacks to the AJAX property.
  $submit =& $form['actions']['submit'];
  $submit['#ajax'] = [
    'callback' => '::ajaxSave',
    'event' => 'click',
    'progress' => [
      'type' => 'throbber',
      'message' => NULL,
    ],
  ];
  return $form;
}