protected function LearningPathAchievementController::build_step_state in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/Controller/LearningPathAchievementController.php \Drupal\opigno_learning_path\Controller\LearningPathAchievementController::build_step_state()
Returns step state renderable array.
Parameters
array $step: Step.
Return value
array Step state renderable array.
1 call to LearningPathAchievementController::build_step_state()
- LearningPathAchievementController::build_course_steps in src/
Controller/ LearningPathAchievementController.php - Returns course steps renderable array.
File
- src/
Controller/ LearningPathAchievementController.php, line 186
Class
- LearningPathAchievementController
- Class LearningPathAchievementController.
Namespace
Drupal\opigno_learning_path\ControllerCode
protected function build_step_state(array $step) {
$uid = $this
->currentUser()
->id();
$status = opigno_learning_path_get_step_status($step, $uid);
$markups = [
'pending' => '<span class="lp_step_state_pending"></span>' . t('Pending'),
'failed' => '<span class="lp_step_state_failed"></span>' . t('Failed'),
'passed' => '<span class="lp_step_state_passed"></span>' . t('Passed'),
];
$markup = isset($markups[$status]) ? $markups[$status] : '‐';
return [
'#markup' => $markup,
];
}