protected function LearningPathAchievementController::build_step_state in Opigno Learning path 3.x
Same name and namespace in other branches
- 8 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.
File
- src/
Controller/ LearningPathAchievementController.php, line 201
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,
];
}