You are here

public function AjaxFormBase::bindAjaxForm in Forena Reports 8

Parameters

\Drupal\forena\Controller\AjaxPageControllerBase $controller:

$form:

\Drupal\Core\Form\FormStateInterface $form_state:

1 call to AjaxFormBase::bindAjaxForm()
ReportModalForm::buildForm in src/Form/ReportModalForm.php
Form constructor.

File

src/Form/AjaxFormBase.php, line 162

Class

AjaxFormBase
Class AjaxFormTrait

Namespace

Drupal\forena\Form

Code

public function bindAjaxForm(AjaxPageControllerBase $controller, &$form, FormStateInterface $form_state) {
  if ($controller->is_modal_form && $controller->jsMode != 'nojs') {
    $form_state
      ->set('e_modal', TRUE);
    $form['#prefix'] = "<div id='e-modal-form'>";
    $form['#suffix'] = "</div>";
  }
  else {
    $form_state
      ->set('e_section', $controller->section);
  }
  $form[$controller::TOKEN_PARAMETER] = [
    '#type' => 'hidden',
    '#value' => $controller
      ->getStateToken(),
  ];

  // Disable caching on this form.
  $form_state
    ->setCached(FALSE);

  // Set the form state handler.
  $controller->form_state = $form_state;

  // Alter the submit handlers.
  $this->controller = $controller;
  $method = "::submitCallback";
  $callback = $method;
  $this
    ->alterForm($form, $callback);
}