You are here

public function LearningPathAchievementController::page_ajax in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/Controller/LearningPathAchievementController.php \Drupal\opigno_learning_path\Controller\LearningPathAchievementController::page_ajax()

Loads next achievements page with a AJAX.

Parameters

int $page: Page id.

Return value

\Drupal\Core\Ajax\AjaxResponse Response.

1 string reference to 'LearningPathAchievementController::page_ajax'
opigno_learning_path.routing.yml in ./opigno_learning_path.routing.yml
opigno_learning_path.routing.yml

File

src/Controller/LearningPathAchievementController.php, line 1132

Class

LearningPathAchievementController
Class LearningPathAchievementController.

Namespace

Drupal\opigno_learning_path\Controller

Code

public function page_ajax($page = 0) {
  $selector = '#achievements-wrapper';
  $content = $this
    ->build_page($page);
  $response = new AjaxResponse();
  if (!empty($content)) {
    $response
      ->addCommand(new AppendCommand($selector, $content));
  }
  return $response;
}