/** * Import a Path into the Platform. * * @param string $structure * @param array $data * @param array $resourcesCreated * * @return Path */ public function import($structure, array $data, array $resourcesCreated = []) { // Create a new Path object which will be populated with exported data $path = new Path(); $pathData = $data['data']['path']; // Populate Path properties $path->setBreadcrumbs(!empty($pathData['breadcrumbs']) ? $pathData['breadcrumbs'] : false); $path->setDescription($pathData['description']); $path->setModified($pathData['modified']); $path->setSummaryDisplayed($pathData['summaryDisplayed']); $path->setCompleteBlockingCondition($pathData['completeBlockingCondition']); $path->setManualProgressionAllowed($pathData['manualProgressionAllowed']); // Create steps $stepData = $data['data']['steps']; if (!empty($stepData)) { $createdSteps = []; foreach ($stepData as $step) { $createdSteps = $this->stepManager->import($path, $step, $resourcesCreated, $createdSteps); } } // Inject empty structure into path (will be replaced by a version with updated IDs later in the import process) $path->setStructure($structure); return $path; }