? ?
avatar rbuelund
rbuelund
16 May 2021

Is your feature request related to a problem? Please describe.

If one uses the Cassiopeia template and wants to use another horisontal menu extension as menu instead of Cassiopeias own menu, then Cassiopeias mobile menu icon is still shown.

Describe the solution you'd like

A setting in the Cassiopeia template to deactivate showing the mobile menu icon. Otherwise a description shown in the template of how you can add some user css to do this.

Additional context

avatar rbuelund rbuelund - open - 16 May 2021
avatar joomla-cms-bot joomla-cms-bot - change - 16 May 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 16 May 2021
avatar chmst chmst - change - 16 May 2021
Labels Added: ?
avatar chmst chmst - labeled - 16 May 2021
avatar brianteeman
brianteeman - comment - 17 May 2021

Cassiopeia doesnt have a menu. I am assuming you are referring to the existing menu published using the core menu module. If that isnt published then it cant and doesnt generate a mobile menu

avatar dgrammatiko
dgrammatiko - comment - 17 May 2021

@brianteeman actually the menu in casseiopeia is leaking hardcoded HTML and also JS behaviour when in reality all it needed was just to echo the module position. Templates should have the least hardcoded HTML and definitely not imposing JS behaviours:

<?php if ($this->countModules('menu', true)) : ?>
<nav class="navbar navbar-expand-md">
<?php HTMLHelper::_('bootstrap.collapse', '.navbar-toggler'); ?>
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="<?php echo Text::_('TPL_CASSIOPEIA_TOGGLE'); ?>">
<span class="icon-menu" aria-hidden="true"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<jdoc:include type="modules" name="menu" style="none" />
</div>
</nav>
<?php endif; ?>

avatar rbuelund
rbuelund - comment - 17 May 2021

You can see the faulty behaviour here:
Mobile Ikon
I have only CK Maxi menu published and no default menu module:
Website modules

avatar brianteeman
brianteeman - comment - 17 May 2021

weird as it didnt happen for me.

avatar eopws
eopws - comment - 17 May 2021

If we turn off the mobile menu icon, how we make the mobile menu accessible?

avatar dgrammatiko
dgrammatiko - comment - 17 May 2021

If we turn off the mobile menu icon, how we make the mobile menu accessible?

The template should only have code for spitting out module positions and the component output. The menu's behaviour should belong to the menu module NOT the template. It's called separation of concerns...

avatar eopws
eopws - comment - 17 May 2021

@dgrammatiko

The template should only have code for spitting out module positions and the component output.

So all we have to do is to move the html from joomla-cms/templates/cassiopeia/index.php (Lines 149 to 159) to the menu module? And then all we need to remove the mobile menu icon is to disable menu module. Am I right?

avatar rbuelund
rbuelund - comment - 17 May 2021

But you would still have to display the module position:
<jdoc:include type="modules" name="menu" style="none" /> - line 156
..for eg another menu extension you want to place in the menu position.

avatar rbuelund
rbuelund - comment - 17 May 2021

..so not that easy

avatar dgrammatiko
dgrammatiko - comment - 17 May 2021

..so not that easy

What are you talking about, probably you don't understand what I wrote.
This is fine

<?php if ($this->countModules('menu', true)) : ?>
  <jdoc:include type="modules" name="menu" style="none" />
<?php endif; ?>

This is a spooky story from the last decade:

				<?php if ($this->countModules('menu', true)) : ?>
					<nav class="navbar navbar-expand-md">
						<?php HTMLHelper::_('bootstrap.collapse', '.navbar-toggler'); ?>
						<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="<?php echo Text::_('TPL_CASSIOPEIA_TOGGLE'); ?>">
							<span class="icon-menu" aria-hidden="true"></span>
						</button>
						<div class="collapse navbar-collapse" id="navbar">
							<jdoc:include type="modules" name="menu" style="none" />
						</div>
					</nav>
				<?php endif; ?>
avatar dgrammatiko
dgrammatiko - comment - 17 May 2021

Am I right?

Yes, probably you should create a new layout, eg main-menu.php or something similar

avatar rbuelund
rbuelund - comment - 17 May 2021

@dgrammatiko I was not refering to your post, but to @eopws about just removing the lines. I agree that it should only be:

`countModules('menu', true)) : ?>
<jdoc:include type="modules" name="menu" style="none" />

`

In the template, and the rest handled in the module.

sorry.. do not know why I cannot insert code correctly in the post ??

avatar sandramay0905
sandramay0905 - comment - 18 May 2021

@rbuelund

sorry.. do not know why I cannot insert code correctly in the post ??

Your last backquote was on a new line, moving it up works:
countModules('menu', true)) : ?> <jdoc:include type="modules" name="menu" style="none" />

avatar eopws
eopws - comment - 18 May 2021

@dgrammatiko

probably you should create a new layout, eg main-menu.php or something similar

If you have time, could you, please, explain what for?

avatar dgrammatiko
dgrammatiko - comment - 18 May 2021

could you, please, explain what for?

In short, this is down to the architecture of Joomla: Modules (or components) can have different output by using a different layout...

avatar eopws
eopws - comment - 18 May 2021

Maybe move this HTML

<?php if ($this->countModules('menu', true)) : ?>
<nav class="navbar navbar-expand-md">
<?php HTMLHelper::_('bootstrap.collapse', '.navbar-toggler'); ?>
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="<?php echo Text::_('TPL_CASSIOPEIA_TOGGLE'); ?>">
<span class="icon-menu" aria-hidden="true"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<jdoc:include type="modules" name="menu" style="none" />
</div>
</nav>
<?php endif; ?>

To

?>
<ul <?php echo ArrayHelper::toString($attributes); ?>>
<?php foreach ($list as $i => &$item)

And then the button
image
will be shown only if "Main Menu Blog" module is published.

avatar drmenzelit
drmenzelit - comment - 18 May 2021

That will only work if you use Metismenu. The sample data were configured to show how to use Metismenu. But you can still have a "normal" Joomla menu on the menu position and it will not be responsive (burger menu) if you move the code into the Metismenu. What we need is a new menu layout (in core or in the template) that includes the Bootstrap part of the menu.

avatar eopws
eopws - comment - 19 May 2021

So we have to have two templates: one for a not responsible menu and one for a responsible menu and choose beetwen them depending on the option?
But I still can understand one thing - if a user have two menus on one position, the mobile menu icon should hide/show both of them or not?

avatar dgrammatiko
dgrammatiko - comment - 19 May 2021

if a user have two menus on one position, the mobile menu icon should hide/show both of them or not?

Menus should render things according to the selected layout. Default should be a simple <ul>, collapsed will be with Bootstrap collapse button and collapse-dropdown with both the button and the metis dropdown... The architecture has the solution for these things, no extra switches needed, in fact, no extra switches should ever being introduced as they break the concept of responsibility (the form is for data, layout options should always be handled in the LAYOUTS)

avatar eopws
eopws - comment - 19 May 2021

@dgrammatiko Thanks.
And sorry for silly questions :)

avatar drmenzelit
drmenzelit - comment - 19 May 2021

Closing with PR #33978 knowing that is not the architectural perfect solution.

avatar richard67 richard67 - change - 19 May 2021
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-05-19 15:09:45
Closed_By richard67
avatar richard67 richard67 - close - 19 May 2021

Add a Comment

Login with GitHub to post a comment