- Add JSON content representation template (recit.json.php) - Create virtual /print page plugin for recit pages - Add recit.php base template for content representation - Create Pinia store for recit data management - Add block components (text, heading, image, list, quote, video, map) - Update PagedJsWrapper for dynamic content rendering with data-page-type - Modify header.php to pass recit JSON URL via data attribute - Update App.vue to load recit data on mount 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Virtual Print Page Plugin
|
|
*
|
|
* Crée une page virtuelle /print pour chaque récit
|
|
* Permet d'accéder à l'éditeur d'impression via /projet/recit/print
|
|
*/
|
|
|
|
use Kirby\Cms\Page;
|
|
use Kirby\Uuid\Uuid;
|
|
|
|
Kirby::plugin('geoproject/virtual-print-page', [
|
|
'routes' => [
|
|
[
|
|
'pattern' => '(:all)/print',
|
|
'action' => function ($parentPath) {
|
|
// Trouver la page parente (le récit)
|
|
$parent = page($parentPath);
|
|
|
|
if (!$parent || $parent->intendedTemplate()->name() !== 'recit') {
|
|
return $this->next();
|
|
}
|
|
|
|
// Créer la page virtuelle avec Page::factory()
|
|
return Page::factory([
|
|
'slug' => 'print',
|
|
'template' => 'print',
|
|
'parent' => $parent,
|
|
'content' => [
|
|
'title' => 'Impression - ' . $parent->title()->value(),
|
|
'uuid' => Uuid::generate()
|
|
]
|
|
]);
|
|
}
|
|
]
|
|
]
|
|
]);
|