<?php

class ProjectPage extends Page {
  public function getSteps() {    
    $steps = [];

    foreach ($this->children() as $child) {
      $steps[] = [
        'text' => $child->title()->value(),
        'value' => $child->stepName()->value(),
        'index' => $child->stepIndex()->value(),
        'modified' => $child->modified('Y-MM-dd'),
        'uri' => $child->uri()
      ];
    }

    usort($steps, function ($a, $b) {
      return $a['index'] <=> $b['index'];
    });

    return $steps;
  }
}