✨ (admin): show the sidebar page only if the theme support it
This commit is contained in:
parent
9dd82a6015
commit
e26aaa72b9
5 changed files with 34 additions and 2 deletions
|
@ -12,6 +12,7 @@ First forked version from bludit
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Admin: Added a sidebar panel that show all sidebar widget to be activated/deactivated
|
- Admin: Added a sidebar panel that show all sidebar widget to be activated/deactivated
|
||||||
|
- Admin: Show some pages only if the theme support their features
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,11 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><span class="fa fa-desktop fa-fw"></span><?php $L->p('Themes') ?></a>
|
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><span class="fa fa-desktop fa-fw"></span><?php $L->p('Themes') ?></a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php if (Theme::supports("sidebar", false)): ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'sidebar' ?>"><span class="fa fa-list fa-fw"></span><?php $L->p('Sidebar') ?></a>
|
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'sidebar' ?>"><span class="fa fa-list fa-fw"></span><?php $L->p('Sidebar') ?></a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<li class="nav-item mt-3">
|
<li class="nav-item mt-3">
|
||||||
<h4><?php $L->p('Settings') ?></h4>
|
<h4><?php $L->p('Settings') ?></h4>
|
||||||
|
|
|
@ -282,4 +282,31 @@ class Theme
|
||||||
// https://github.com/psfpro/bootstrap-html5sortable
|
// https://github.com/psfpro/bootstrap-html5sortable
|
||||||
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'jquery.sortable.min.js?version=' . KOBLOG_VERSION . '"></script>' . PHP_EOL;
|
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'jquery.sortable.min.js?version=' . KOBLOG_VERSION . '"></script>' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function supports($featureToCheck, $verifySidebar = true)
|
||||||
|
{
|
||||||
|
global $site;
|
||||||
|
global $themes;
|
||||||
|
$themeName = $site->theme();
|
||||||
|
|
||||||
|
if (isset($themes)) {
|
||||||
|
foreach ($themes as $theme) {
|
||||||
|
if ($theme['dirname'] == $site->theme()) {
|
||||||
|
if (isset($theme['supports'])) {
|
||||||
|
foreach ($theme['supports'] as $feature) {
|
||||||
|
if ($featureToCheck == $feature) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ($verifySidebar && $feature == "sidebar") {
|
||||||
|
// TODO: add check to see if a plugin support it in the sidebar
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"compatible": "3.15",
|
"compatible": "3.15",
|
||||||
"notes": "",
|
"notes": "",
|
||||||
"plugin": "alternative"
|
"plugin": "alternative",
|
||||||
|
"supports": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
"releaseDate": "2024-08-23",
|
"releaseDate": "2024-08-23",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"compatible": "kb_0.0.1",
|
"compatible": "kb_0.0.1",
|
||||||
"notes": ""
|
"notes": "",
|
||||||
|
"supports": ["sidebar"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue