You are here

private function UserAchievements::getTabContent in Opigno statistics 3.x

Build the content depending on the given tab name.

Parameters

int $uid: The user ID to get the tab content for.

string $tab: The tab machine name to get the content for.

Return value

array The render array to display the tab content.

2 calls to UserAchievements::getTabContent()
UserAchievements::achievementsPage in src/Controller/UserAchievements.php
Build the user achievements page content.
UserAchievements::switchTabs in src/Controller/UserAchievements.php
Ajax callback to swith tabs content.

File

src/Controller/UserAchievements.php, line 174

Class

UserAchievements
User achievements page controller.

Namespace

Drupal\opigno_statistics\Controller

Code

private function getTabContent(int $uid, string $tab) : array {
  switch ($tab) {
    case static::CERTIFICATES_TAB:
      $content = $this->statsManager
        ->buildCertificatesList($uid);
      break;
    case static::BADGES_TAB:
      $content = $this->statsManager
        ->buildBadgesList($uid);
      break;
    case static::SKILLS_TAB:
      $content = $this->statsManager
        ->buildSkillsList($uid);
      break;
    default:
      $content = $this->statsManager
        ->buildTrainingsList($uid, TRUE);
  }
  return $content;
}