You are here

public function DocumentBase::addAjaxCommand in Forena Reports 8

Parameters

array $ajax: The Array of coommand objects

string $event: 'pre' implies pre replacement firing of events.

File

src/FrxPlugin/Document/DocumentBase.php, line 126
DocumentBase.inc Given a report, render the appropriate output given the document format. @author davidmetzler

Class

DocumentBase

Namespace

Drupal\forena\FrxPlugin\Document

Code

public function addAjaxCommand($ajax, $event) {
  $command = $ajax['command'];
  $plugins = AppService::instance()
    ->getAjaxPlugins();
  if (isset($plugins[$command])) {
    $class = $plugins[$command];

    /** @var AjaxCommandInterface $command */
    $command = new $class();
    $ajax_command = $command
      ->commandFromSettings($ajax);
    if ($ajax_command) {
      $this->commands[$event][] = $ajax_command;
    }
  }
}