This commit is contained in:
parent
6804a4c9b7
commit
7815c8b49a
3 changed files with 32 additions and 10 deletions
|
|
@ -4,19 +4,27 @@ use adrienpayet\notifications\NotificationsPage;
|
|||
|
||||
class ProjectPage extends NotificationsPage {
|
||||
public function getSteps() {
|
||||
$steps = [];
|
||||
$apiCache = kirby()->cache('api');
|
||||
$stepsData = $apiCache->get($this->slug() . '_' . 'steps');
|
||||
|
||||
foreach ($this->children() as $child) {
|
||||
try {
|
||||
$steps[] = $this->createStep($child);
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
if ($stepsData === null) {
|
||||
$steps = [];
|
||||
|
||||
foreach ($this->children() as $child) {
|
||||
try {
|
||||
$steps[] = $this->createStep($child);
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
}
|
||||
}
|
||||
|
||||
usort($steps, fn($a, $b) => $a['index'] <=> $b['index']);
|
||||
|
||||
$apiCache->set($this->slug() . '_' . 'steps', $steps);
|
||||
return $steps;
|
||||
} else {
|
||||
return $stepsData;
|
||||
}
|
||||
|
||||
usort($steps, fn($a, $b) => $a['index'] <=> $b['index']);
|
||||
|
||||
return $steps;
|
||||
}
|
||||
|
||||
private function createStep($child) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue