Move sidebar toggle from sidebar panel to breadcrumb navigation, positioned left of the HOME icon. Uses distinct icons for open (sidebar-inset) and closed (sidebar) states. Sidebar state persists via sessionStorage. Remove old non-functional toggle buttons from layout and HTMLBlock plugin.
80 lines
2.7 KiB
PHP
80 lines
2.7 KiB
PHP
<?php
|
|
|
|
class HTMLBlock
|
|
{
|
|
private array $config;
|
|
private ?CMSAPI $api = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->config = [
|
|
'title' => 'HTML Block Plugin'
|
|
];
|
|
}
|
|
|
|
public function setAPI(CMSAPI $api): void
|
|
{
|
|
$this->api = $api;
|
|
}
|
|
|
|
public function getSidebarContent(): string
|
|
{
|
|
$currentPage = $this->api ? $this->api->getCurrentPageTitle() : 'Onbekend';
|
|
$isHomepage = $this->api ? $this->api->isHomepage() : false;
|
|
$currentLang = $this->api ? $this->api->getCurrentLanguage() : 'nl';
|
|
|
|
$content = '
|
|
<div class="card mb-3">
|
|
<div class="card-header">
|
|
<h5 class="mb-0">' . $this->config['title'] . '</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="mb-2"><strong>Huidige pagina:</strong> ' . htmlspecialchars($currentPage) . '</p>
|
|
<p class="mb-2"><strong>Taal:</strong> ' . strtoupper($currentLang) . '</p>
|
|
<p class="mb-3"><strong>Homepage:</strong> ' . ($isHomepage ? 'Ja' : 'Nee') . '</p>';
|
|
|
|
// Add page-specific content
|
|
if ($this->api) {
|
|
$fileInfo = $this->api->getCurrentPageFileInfo();
|
|
if ($fileInfo) {
|
|
$content .= '
|
|
<div class="alert alert-info mb-3">
|
|
<small>
|
|
<strong>Bestandsinfo:</strong><br>
|
|
Aangemaakt: ' . htmlspecialchars($fileInfo['created']) . '<br>
|
|
Gewijzigd: ' . htmlspecialchars($fileInfo['modified']) . '
|
|
</small>
|
|
</div>';
|
|
}
|
|
|
|
// Add quick navigation
|
|
$menu = $this->api->getMenu();
|
|
if (!empty($menu)) {
|
|
$content .= '
|
|
<h6>Quick Navigation</h6>
|
|
<ul class="list-unstyled mb-3">';
|
|
|
|
foreach ($menu as $item) {
|
|
if ($item['type'] === 'file') {
|
|
$url = $this->api->createUrl($item['path']);
|
|
$content .= '<li><a href="' . htmlspecialchars($url) . '" class="text-decoration-none">📄 ' . htmlspecialchars($item['title']) . '</a></li>';
|
|
}
|
|
}
|
|
|
|
$content .= '</ul>';
|
|
}
|
|
}
|
|
|
|
return $content;
|
|
}
|
|
|
|
public function getConfig(): array
|
|
{
|
|
return $this->config;
|
|
}
|
|
|
|
public function setConfig(array $config): void
|
|
{
|
|
$this->config = array_merge($this->config, $config);
|
|
}
|
|
} |