Standardize French template names to English across blueprints, content files, PHP templates, Vue components and Pinia stores. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1 KiB
PHP
37 lines
1 KiB
PHP
<?php
|
|
/**
|
|
* Virtual Print Page Plugin
|
|
*
|
|
* Creates a virtual /print page for each narrative
|
|
* Allows access to print editor via /project/narrative/print
|
|
*/
|
|
|
|
use Kirby\Cms\Page;
|
|
use Kirby\Uuid\Uuid;
|
|
|
|
Kirby::plugin('geoproject/virtual-print-page', [
|
|
'routes' => [
|
|
[
|
|
'pattern' => '(:all)/print',
|
|
'action' => function ($parentPath) {
|
|
// Find parent page (the narrative)
|
|
$parent = page($parentPath);
|
|
|
|
if (!$parent || $parent->intendedTemplate()->name() !== 'narrative') {
|
|
return $this->next();
|
|
}
|
|
|
|
// Create virtual page with Page::factory()
|
|
return Page::factory([
|
|
'slug' => 'print',
|
|
'template' => 'print',
|
|
'parent' => $parent,
|
|
'content' => [
|
|
'title' => 'Print - ' . $parent->title()->value(),
|
|
'uuid' => Uuid::generate()
|
|
]
|
|
]);
|
|
}
|
|
]
|
|
]
|
|
]);
|