julienmonnerie/kirby/views/panel.php

82 lines
1.8 KiB
PHP
Raw Normal View History

2022-06-17 17:51:59 +02:00
<?php
2022-08-31 15:02:43 +02:00
2025-04-21 18:57:21 +02:00
use Kirby\Toolkit\Html;
2022-08-31 15:02:43 +02:00
2022-06-17 17:51:59 +02:00
/**
* @var \Kirby\Cms\App $kirby
* @var string $icons
* @var array<string, mixed> $assets
* @var array<string, mixed> $fiber
* @var string $panelUrl
* @var string $nonce
*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="referrer" content="same-origin">
<title>Kirby Panel</title>
2025-07-11 14:41:34 +02:00
<script type="importmap">
{
"imports": <?= json_encode($assets['import-maps'] ?? []) ?>
}
</script>
2022-06-17 17:51:59 +02:00
<script nonce="<?= $nonce ?>">
if (
!window.CSS ||
window.CSS.supports("display", "grid") === false ||
!window.fetch
) {
window.location.href = "<?= $panelUrl ?>browser";
}
</script>
<?php foreach ($assets['css'] as $css): ?>
<link nonce="<?= $nonce ?>" rel="stylesheet" href="<?= $css ?>">
<?php endforeach ?>
2025-04-21 18:57:21 +02:00
<?php foreach ($assets['icons'] as $icon): ?>
<?= Html::tag('link', null, $icon) ?>
2022-08-31 15:02:43 +02:00
<?php endforeach ?>
<?php foreach ($assets['js'] as $js): ?>
<?php if (($js['type'] ?? null) === 'module'): ?>
<link rel="modulepreload" href="<?= $js['src'] ?>">
<?php endif ?>
2022-06-17 17:51:59 +02:00
<?php endforeach ?>
<base href="<?= $panelUrl ?>">
</head>
<body>
<div id="app"></div>
<noscript>
Please enable JavaScript in your browser
</noscript>
<?= $icons ?>
<script nonce="<?= $nonce ?>">
// Fiber setup
2025-04-21 18:57:21 +02:00
window.fiber = <?= json_encode($fiber) ?>;
2022-06-17 17:51:59 +02:00
</script>
2025-07-11 14:41:34 +02:00
<?php foreach ($assets['js'] as $key => $js): ?>
<?php if ($key === 'index'): ?>
<script type="module" nonce="<?= $nonce ?>" defer>
<?= $assets['plugin-imports'] ?>
import('<?= $js['src'] ?>')
</script>
<?php else: ?>
<?= Html::tag('script', '', $js) . PHP_EOL ?>
<?php endif ?>
<?php endforeach ?>
2022-06-17 17:51:59 +02:00
</body>
</html>