optional steps blueprints - change statuses label
This commit is contained in:
parent
8da0fb0e36
commit
83cf6beea7
36 changed files with 129 additions and 95 deletions
|
|
@ -3,6 +3,12 @@ icon: light-bulb
|
|||
image:
|
||||
back: black
|
||||
color: white
|
||||
status:
|
||||
draft:
|
||||
label: Désactivée
|
||||
unlisted: false
|
||||
listed: true
|
||||
label: Activée
|
||||
|
||||
tabs:
|
||||
contentTab:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@ icon: image
|
|||
image:
|
||||
back: black
|
||||
color: white
|
||||
status:
|
||||
draft:
|
||||
label: Désactivée
|
||||
unlisted: false
|
||||
listed: true
|
||||
label: Activée
|
||||
|
||||
tabs:
|
||||
contentTab:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
title: Projets
|
||||
|
||||
sections:
|
||||
fieldsSection:
|
||||
type: fields
|
||||
fields:
|
||||
steps:
|
||||
label: Étapes
|
||||
type: tags
|
||||
drafts:
|
||||
extends: sections/projects
|
||||
headline: Brouillons
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ return [
|
|||
require(__DIR__ . '/routes/toggle-favorite.php'),
|
||||
],
|
||||
'hooks' => [
|
||||
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php')
|
||||
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
||||
'page.delete:before' => require_once(__DIR__ . '/hooks/delete-steps.php'),
|
||||
]
|
||||
];
|
||||
|
|
|
|||
10
public/site/config/hooks/delete-steps.php
Normal file
10
public/site/config/hooks/delete-steps.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
return function($page) {
|
||||
if ($page->template() == "project") {
|
||||
kirby()->impersonate('kirby');
|
||||
foreach ($page->children() as $child) {
|
||||
$child->delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -6,10 +6,15 @@ class ProjectPage extends Page {
|
|||
$steps = array_map(function($child) {
|
||||
return [
|
||||
'text' => $child['content']['title'],
|
||||
'value' => $child['content']['stepname']
|
||||
'value' => $child['content']['stepname'],
|
||||
'index' => $child['content']['stepindex']
|
||||
];
|
||||
}, $this->children()->toArray());
|
||||
|
||||
usort($steps, function ($a, $b) {
|
||||
return $a['index'] <=> $b['index'];
|
||||
});
|
||||
|
||||
return $steps;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue