Add blog extension
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
$modules = [
|
||||
'posts' => [
|
||||
'include' => __DIR__ . '/Views/ListPosts.php',
|
||||
'label' => 'Posts',
|
||||
'icon' => 'ph-article',
|
||||
'inMenu' => true,
|
||||
],
|
||||
'categories' => [
|
||||
'include' => __DIR__ . '/Views/ListCategories.php',
|
||||
'label' => 'Categories',
|
||||
'icon' => 'ph-tag',
|
||||
'inMenu' => true,
|
||||
],
|
||||
'editPost' => [
|
||||
'include' => __DIR__ . '/Views/EditPost.php',
|
||||
'inMenu' => false,
|
||||
],
|
||||
];
|
||||
|
||||
$activeModule = isset($_GET['action']) && array_key_exists($_GET['action'], $modules) ? $_GET['action'] : 'posts';
|
||||
|
||||
?>
|
||||
<nav class="mb-6 overflow-x-auto" aria-label="Blog extension navigation">
|
||||
<div class="tabs tabs-box w-max min-w-full bg-base-200/50">
|
||||
<?php foreach ($modules as $name => $module): ?>
|
||||
<?php if (!$module['inMenu']) continue; ?>
|
||||
<a class="tab gap-2 <?= $name === $activeModule ? 'tab-active' : '' ?>" <?= $name === $activeModule ? 'aria-current="page"' : '' ?> href="<?= phpb_url('website_manager', ['tab' => 'ext--blog', 'action' => $name]) ?>">
|
||||
<i class="ph-duotone <?= phpb_e($module['icon']) ?>" aria-hidden="true"></i>
|
||||
<?= phpb_e($module['label']) ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="w-full">
|
||||
<?php include $modules[$activeModule]['include']; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user