public function UserController::ajaxLoadTrainingModuleDetails in Opigno statistics 8
Same name and namespace in other branches
- 3.x src/Controller/UserController.php \Drupal\opigno_statistics\Controller\UserController::ajaxLoadTrainingModuleDetails()
Loads module panel with a AJAX.
Parameters
\Drupal\user\UserInterface $user: User.
\Drupal\group\Entity\GroupInterface $training: Training.
\Drupal\opigno_module\Entity\OpignoModule $module: Module.
Return value
\Drupal\Core\Ajax\AjaxResponse AJAX response.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 string reference to 'UserController::ajaxLoadTrainingModuleDetails'
File
- src/
Controller/ UserController.php, line 1103
Class
- UserController
- Class UserController.
Namespace
Drupal\opigno_statistics\ControllerCode
public function ajaxLoadTrainingModuleDetails(UserInterface $user, GroupInterface $training, OpignoModule $module) {
$training_id = $training
->id();
$module_id = $module
->id();
$user_id = $user
->id();
$selector = "#module_panel_{$user_id}_{$training_id}_{$module_id}";
$content = $this
->buildModuleDetails($user, $training, NULL, $module);
$content['#attributes']['data-ajax-loaded'] = TRUE;
$response = new AjaxResponse();
$response
->addCommand(new ReplaceCommand($selector, $content));
return $response;
}