-
Notifications
You must be signed in to change notification settings - Fork 1
/
offcanvas.php
62 lines (54 loc) · 2.46 KB
/
offcanvas.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
// Activate offcanvas javascript
HTMLHelper::_('bootstrap.offcanvas');
// Get template variables
$app = Factory::getApplication('site');
$template = $app->getTemplate(true);
$siteTitle = $template->params->get('siteTitle', '');
$offcanvas = 'joffcanvas' . $module->id;
$offcanvasName = 'offcanvasNavbar' . $module->id;
$modId = 'joffcanvas' . $module->id;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $app->getDocument()->getWebAssetManager();
$wa->addInlineStyle('
#' . $modId . ' .offcanvas.show .offcanvas-body ul {
position: relative;
width: 100%;
-webkit-box-shadow: none;
box-shadow: none;
background-color: transparent;}
#' . $modId . ' .offcanvas .offcanvas-body a,
#' . $modId . ' .offcanvas .offcanvas-body button {
color: var(--body-color);}
#' . $modId . ' .offcanvas .offcanvas-body a:active,
#' . $modId . ' .offcanvas .offcanvas-body button:active,
#' . $modId . ' .offcanvas .offcanvas-body a:hover,
#' . $modId . ' .offcanvas .offcanvas-body button:hover {
color: var(--cassiopeia-color-link);}
#' . $modId . ' .offcanvas.show .offcanvas-body .active > a,
#' . $modId . ' .offcanvas.show .offcanvas-body .active > button {
color: var(--cassiopeia-color-link);}
', ['name' => $modId]);
?>
<nav id="<?php echo $offcanvas; ?>" class="navbar navbar-expand-lg mt-0 w-100" aria-label="Offcanvas navbar large">
<div class="container-fluid p-0">
<a class="navbar-brand" href="<?php echo URI::base(true); ?>"><?php echo $siteTitle; ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#<?php echo $offcanvasName; ?>" aria-controls="<?php echo $offcanvasName; ?>">
<span class="icon-menu" aria-hidden="true"></span>
</button>
<div class="offcanvas offcanvas-end" tabindex="-1" id="<?php echo $offcanvasName; ?>"
aria-labelledby="<?php echo $offcanvasName; ?>Label">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="<?php echo $offcanvasName; ?>Label"><?php echo $module->title; ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body p-0 text-primary">
<?php require(__DIR__ . '/dropdown-metismenu.php'); ?>
</div>
</div>
</div>
</nav>