geoproject-app/public/site/plugins/virtual-print-page/index.php
isUnknown af788ad1e0 refactor: rename 'recit' to 'narrative' for English code naming
- Rename store: recit.js → narrative.js (useRecitStore → useNarrativeStore)
- Rename templates: recit.php/json.php → narrative.php/json.php
- Rename blueprint: recit.yml → narrative.yml
- Update all imports and references in Vue/JS files
- Update PHP template references and data attributes
- Update CLAUDE.md documentation
- Create comprehensive README.md with English-French dictionary

The dictionary section maps English code terms to French content terms
for easier navigation between codebase and CMS content.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-09 10:34:10 +01:00

37 lines
1 KiB
PHP

<?php
/**
* Virtual Print Page Plugin
*
* Creates a virtual /print page for each narrative
* Allows access to print editor via /projet/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()
]
]);
}
]
]
]);