protected function StatisticsPageTrait::buildStatus in Opigno statistics 3.x
Same name and namespace in other branches
- 8 src/StatisticsPageTrait.php \Drupal\opigno_statistics\StatisticsPageTrait::buildStatus()
Builds render array for a status value.
Parameters
string $value: Status.
Return value
array Render array.
6 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 206
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 = Markup::create('<i class="fi fi-rr-menu-dots"></i>' . $this
->t('Pending'));
break;
case 'expired':
$status_icon = 'icon_state_expired';
$status_text = Markup::create('<i class="fi fi-rr-cross-small"></i>' . $this
->t('Expired'));
break;
case 'failed':
$status_icon = 'icon_state_failed';
$status_text = Markup::create('<i class="fi fi-rr-cross-small"></i>' . $this
->t('Failed'));
break;
case 'completed':
case 'passed':
$status_icon = 'icon_state_passed';
$status_text = Markup::create('<i class="fi fi-rr-check"></i>' . $this
->t('Success'));
break;
}
return [
'#type' => 'html_tag',
'#tag' => 'span',
'#attributes' => [
'class' => [
'icon_state',
$status_icon,
],
],
'#value' => $status_text,
];
}