public function LearningPathAchievementController::course_module_panel_ajax in Opigno Learning path 3.x
Same name and namespace in other branches
- 8 src/Controller/LearningPathAchievementController.php \Drupal\opigno_learning_path\Controller\LearningPathAchievementController::course_module_panel_ajax()
Loads module panel with a AJAX.
Parameters
\Drupal\group\Entity\GroupInterface $training: Training group.
null|\Drupal\group\Entity\GroupInterface $course: Course group.
\Drupal\opigno_module\Entity\OpignoModule $opigno_module: Opigno module.
Return value
\Drupal\Core\Ajax\AjaxResponse Response.
1 string reference to 'LearningPathAchievementController::course_module_panel_ajax'
File
- src/
Controller/ LearningPathAchievementController.php, line 965
Class
- LearningPathAchievementController
- Class LearningPathAchievementController.
Namespace
Drupal\opigno_learning_path\ControllerCode
public function course_module_panel_ajax(GroupInterface $training, GroupInterface $course, OpignoModule $opigno_module) {
$training_id = $training
->id();
$course_id = $course
->id();
$module_id = $opigno_module
->id();
$selector = "#module_panel_{$training_id}_{$course_id}_{$module_id}";
$content = $this
->build_module_panel($training, $course, $opigno_module);
$content['#attributes']['data-ajax-loaded'] = TRUE;
$response = new AjaxResponse();
$response
->addCommand(new ReplaceCommand($selector, $content));
return $response;
}