protected function StatisticsPageTrait::buildScore in Opigno statistics 3.x
Same name and namespace in other branches
- 8 src/StatisticsPageTrait.php \Drupal\opigno_statistics\StatisticsPageTrait::buildScore()
Builds render array for a score value.
Parameters
int $value: Score.
Return value
array Render array.
5 calls to StatisticsPageTrait::buildScore()
- DashboardForm::buildSkillsTable in src/
Form/ DashboardForm.php - Builds skills listing.
- 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.
File
- src/
StatisticsPageTrait.php, line 161
Class
- StatisticsPageTrait
- Common helper methods for a statistics pages.
Namespace
Drupal\opigno_statisticsCode
protected function buildScore($value) {
return [
'#type' => 'container',
'#attributes' => [
'class' => [
'learning-path-progress d-flex flex-column',
],
],
'score' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'progress-content',
],
],
'score_value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#attributes' => [
'class' => [
'progress-value',
],
],
'#value' => $value . '%',
],
],
'score_bar' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'progress-bar',
],
],
'score_bar_inner' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'progress-progress',
],
'style' => "width: {$value}%;",
],
],
],
];
}