private function OpignoScormPlayer::opignoScormPlayerFlattenTree in Opigno SCORM 8
Same name and namespace in other branches
- 3.x src/OpignoScormPlayer.php \Drupal\opigno_scorm\OpignoScormPlayer::opignoScormPlayerFlattenTree()
Helper function to flatten the SCORM tree.
Parameters
array $tree: Tree.
Return value
array SCORM tree.
1 call to OpignoScormPlayer::opignoScormPlayerFlattenTree()
- OpignoScormPlayer::toRendarableArray in src/
OpignoScormPlayer.php - Build rendarable array for scorm package output.
File
- src/
OpignoScormPlayer.php, line 137
Class
- OpignoScormPlayer
- Class OpignoScormPlayer.
Namespace
Drupal\opigno_scormCode
private function opignoScormPlayerFlattenTree(array $tree) {
$items = [];
if (!empty($tree)) {
foreach ($tree as $sco) {
$items[] = $sco;
if (!empty($sco->children)) {
$items = array_merge($items, $this
->opignoScormPlayerFlattenTree($sco->children));
}
}
}
return $items;
}