Skip to content

Commit

Permalink
kirby docs are wrong 👎
Browse files Browse the repository at this point in the history
  • Loading branch information
tobimori authored Jul 8, 2024
1 parent bad50b4 commit b26adb1
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions classes/DreamForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,30 +190,18 @@ public static function install(): void
}

$isUuid = Str::startsWith($page, "page://");
$content = [
'content' => [
'uuid' => $isUuid ? Str::after($page, "page://") : 'forms',
]
];

if ($kirby->multilang()) {
$content = [
'translations' => [
$kirby->languages()->default()->code() => array_merge(
$content,
[
'code' => $kirby->languages()->default()->code()
]
)
]
];
}

// create the page
$kirby->impersonate('kirby', fn () => $kirby->site()->createChild(array_merge([
'slug' => $isUuid ? "forms" : $page,
'template' => 'forms',
], $content)));
$kirby->impersonate(
'kirby',
fn () => $kirby->site()->createChild([
'slug' => $isUuid ? "forms" : $page,
'template' => 'forms',
'content' => [
'uuid' => $isUuid ? Str::after($page, "page://") : 'forms',
]
])->changeStatus('unlisted')
);
}

/**
Expand Down

0 comments on commit b26adb1

Please sign in to comment.