You are here

public function AjaxPageControllerBase::page in Forena Reports 8

Default page controller implementation. This method is typically what you would reference in the routing.yml file as the main menu callback for the controller.

Parameters

$action:

string $js_mode:

Return value

array|\Symfony\Component\HttpFoundation\RedirectResponse

Overrides AjaxControllerInterface::page

File

src/Controller/AjaxPageControllerBase.php, line 250

Class

AjaxPageControllerBase

Namespace

Drupal\forena\Controller

Code

public function page($action = '', $js_mode = 'nojs') {
  $this->jsMode = $js_mode;
  if (!empty($_GET['_wrapper_format'])) {
    $this->jsMode = $_GET['_wrapper_format'];
  }
  if (!$action && $this->jsMode == 'nojs') {
    $route_name = \Drupal::routeMatch()
      ->getRouteName();
    return $this
      ->redirect($route_name, [
      'action' => static::DEFAULT_ACTION,
    ]);
  }
  else {
    $build = $this
      ->response($action);
    return $build;
  }
}