You are here

public function LearningPathAchievementController::getModulesStatusBadges in Opigno Learning path 3.x

Gets the badges by the step.

Copy of legacy code.

3 calls to LearningPathAchievementController::getModulesStatusBadges()
LearningPathAchievementController::build_course_steps in src/Controller/LearningPathAchievementController.php
Returns course steps renderable array.
LearningPathAchievementController::trainingStepCourseBuild in src/Controller/LearningPathAchievementController.php
If step is course prepares a render array of content.
LearningPathAchievementController::trainingStepModuleBuild in src/Controller/LearningPathAchievementController.php
If step is module prepares a render array of content.

File

src/Controller/LearningPathAchievementController.php, line 678

Class

LearningPathAchievementController
Class LearningPathAchievementController.

Namespace

Drupal\opigno_learning_path\Controller

Code

public function getModulesStatusBadges($step, $group, $uid) {

  // Get existing badge count.
  $badges = 0;
  if (in_array($step['typology'], [
    'Course',
    'Module',
  ]) && \Drupal::moduleHandler()
    ->moduleExists('opigno_module')) {
    $result = OpignoModuleBadges::opignoModuleGetBadges($uid, $group
      ->id(), $step['typology'], $step['id']);
    if ($result) {
      $badges = $result;
    }
  }
  return $badges;
}