designtopack/public/site/models/project.php
isUnknown 965c015c2c test
2024-10-16 17:32:36 +02:00

32 lines
No EOL
724 B
PHP

<?php
class ProjectPage extends Page {
public function getSteps() {
$steps = [];
foreach ($this->children() as $child) {
$files = [];
if ($child->stepName() == 'clientBrief') {
foreach ($child->moodboard()->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;
}
}