protected function StatisticsPageTrait::buildStatus in Opigno statistics 8
Same name and namespace in other branches
- 3.x src/StatisticsPageTrait.php \Drupal\opigno_statistics\StatisticsPageTrait::buildStatus()
Builds render array for a status value.
Parameters
string $value: Status.
Return value
array Render array.
5 calls to StatisticsPageTrait::buildStatus()
- TrainingForm::buildUsersResultsClass in src/
Form/ TrainingForm.php - Builds users results for Classes.
- TrainingForm::buildUsersResultsLp in src/
Form/ TrainingForm.php - Builds users results for Learning paths.
- UserController::buildCourseDetails in src/
Controller/ UserController.php - Builds render array for a user course details.
- UserController::buildTrainingDetails in src/
Controller/ UserController.php - Builds render array for a user training details.
- UserController::buildTrainingsList in src/
Controller/ UserController.php - Builds render array for a user trainings list.
File
- src/
StatisticsPageTrait.php, line 139
Class
- StatisticsPageTrait
- Common helper methods for a statistics pages.
Namespace
Drupal\opigno_statisticsCode
protected function buildStatus($value) {
switch (strtolower($value)) {
default:
case 'pending':
$status_icon = 'icon_state_pending';
$status_text = $this
->t('Pending');
break;
case 'expired':
$status_icon = 'icon_state_expired';
$status_text = $this
->t('Expired');
break;
case 'failed':
$status_icon = 'icon_state_failed';
$status_text = $this
->t('Failed');
break;
case 'completed':
case 'passed':
$status_icon = 'icon_state_passed';
$status_text = $this
->t('Passed');
break;
}
return [
[
'#type' => 'html_tag',
'#tag' => 'span',
'#attributes' => [
'class' => [
'icon_state',
$status_icon,
],
],
],
[
'#markup' => $status_text,
],
];
}