public function prepareData($freshData) { $roots = new Roots(); $tempArray = $this->getModules($freshData); $this->page['moduleData'] = json_encode($tempArray); $tags = $roots->getAvailableTags(); if (strlen($tags) > 0) { $tags = explode(', ', $tags); } else { $tags = []; } $this->page['avTags'] = json_encode($tags); $completionReqs = $roots->getCompletionRequirementTypes(); $result = array(); $i = 0; foreach ($completionReqs as $type) { $item = new \stdClass(); $item->id = $i; $item->value = $type; $item->text = $this->getText($type); $result[] = $item; $i++; } $this->page['completionRequirementTypes'] = json_encode($result); }