children() as $child) { $files = []; if ($child->stepName() == 'clientBrief') { foreach ($child->moodboard()->toFiles() as $file) { $files[] = getFileData($file); } foreach ($child->pdf()->toFiles() as $file) { $files[] = getFileData($file); } } $steps[] = [ 'text' => $child->title()->value(), 'value' => $child->stepName()->value(), 'index' => $child->stepIndex()->value(), 'modified' => $child->modified('Y-MM-dd'), 'uri' => $child->uri(), 'files' => $files ]; } usort($steps, function ($a, $b) { return $a['index'] <=> $b['index']; }); return $steps; } public function getStepLabel() { $stepsLabel = [ "clientBrief" => "brief", "proposal" => "offre commerciale", "extendedBrief" => "brief enrichi", "industrialIdeation" => "idéation industrielle", "virtualSample" => "échantillon virtuel", "physicalSample" => "échantillon physique", ]; return $stepsLabel[$this->currentStep()->value()]; } }