You are here

protected function AjaxPageControllerBase::getModalForm in Forena Reports 8

Parameters

string $section: The class name of the form to render.

string $class: The class name of the form to get.

string $title: The title to be used on the modal.

array $options: Array of Jquery UI Dialog options as described at http://api.jqueryui.com/dialog

2 calls to AjaxPageControllerBase::getModalForm()
AjaxPageControllerBase::modalReport in src/Controller/AjaxPageControllerBase.php
Render a forena report in a modal
AjaxPageControllerBase::processForm in src/Controller/AjaxPageControllerBase.php
Processes the form based on a form_id

File

src/Controller/AjaxPageControllerBase.php, line 502

Class

AjaxPageControllerBase

Namespace

Drupal\forena\Controller

Code

protected function getModalForm($section, $class, $title, $options = []) {
  $modal = $this->is_modal_form;
  $this->is_modal_form = TRUE;
  if (empty($_POST['form_id']) || $class::FORM_ID != $this->post_form_id) {
    $content = \Drupal::formBuilder()
      ->getForm($class);
    if ($this->jsMode != 'nojs') {
      if (!$this->modal_added) {
        $this->commands[] = new OpenModalDialogCommand($title, $content, $options);
        $this->modal_added = TRUE;

        // If autoResize is not manually disabled draggable will always be disabled
        // by drupal javascript.  So we add a command to enable it manually after
        // the form is initially sized.
        if (!isset($options['autoResize']) && !empty($options['draggable'])) {
          $this->commands[] = new InvokeCommand('#drupal-modal', 'eModalDraggable');
        }
      }
    }
    else {
      $this->build[$section] = $content;
    }
  }
  $this->is_modal_form = $modal;
}