Defect #1635
ModuleNavigation not behaving as expected with 2.8.1
| Status: | Completed | Start: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | leo | % Done: | 0% |
|
| Category: | frontend | |||
| Target version: | 2.8.2 |
Description
Updated to 2.8.1 and navigation modules that have a reference page selected in the navigation are now not displaying. If I remove the reference page setting in the module, it runs as expected from the top level, but the reference page seems to be behaving strangely.
Hoping this is a bug and not a change in the way the Navigation Module is structured. I am digging a little deeper to discover exactly why it is happening, but backing out to the 2.8.0 version of ModuleNavigation.php seems to fix everything for now.
Related issues
| follows Feature #1607: Navigationsmenü - Referenzseite hebelt Funktionen aus (TL 2.8.0) | Completed |
History
Updated by winanscreative 6 months ago
Seems to happen on the TYPOlight demo site as well. If I set the reference page on the Main Navigation module it does not render out on the FE.
Updated by winanscreative 6 months ago
Another update. Seems to work properly if the page you are on is within the trail of the navigation, but not when you are outside the trail. I know that the module used to allow you to do this.
Updated by Nina 6 months ago
Seems that another user also found this bug:
http://www.typolight-community.de/showthread.php?t=6964 (german forum)
Updated by leo 6 months ago
It now behaves like a submenu, which is not displayed if a page outside the trail is selected. Try adding the following code snippet to frontend/ModuleNavigation.php in line 101:
if (!$found)
{
$trail = array($this->rootPage);
$level = 0;
}
Let me know if that fixes the issue.
Updated by winanscreative 6 months ago
Yes, that seems to work, but is it negating what you were trying to do there? I have the following code now, starting at line 82:
// Overwrite with a custom reference page
if ($this->defineRoot && $this->rootPage > 0)
{
$trail = array();
$blnFound = false;
// Check whether the reference page is within the trail
foreach ($objPage->trail as $id)
{
if ($id == $this->rootPage)
{
$blnFound = true;
}
if ($blnFound)
{
$trail[] = $id;
}
}
}
if (!$blnFound)
{
$trail = array($this->rootPage);
$level = 0;
}
I set up a lot of site menus that make use of the reference page because I can keep them organized in the site structure, like this:
- Home
- Top Nav
- Topnav 1
- Topnav 2
- Topnav 3
- Main Nav
- Mainnav 1
- Mainnav 2
- Mainnav 3
And I need them to be universally available, but I can see what you meant to do with it. Perhaps an option to restrict to pages within the trail?
Updated by leo 6 months ago
You have pasted it in the wrong line!
// Overwrite with a custom reference page
if ($this->defineRoot && $this->rootPage > 0)
{
$trail = array();
$blnFound = false;
// Check whether the reference page is within the trail
foreach ($objPage->trail as $id)
{
if ($id == $this->rootPage)
{
$blnFound = true;
}
if ($blnFound)
{
$trail[] = $id;
}
}
if (!$blnFound)
{
$trail = array($this->rootPage);
$level = 0;
}
}Updated by winanscreative 6 months ago
My fault! Yes, that makes more sense... Working great, thank you!
Updated by leo 6 months ago
- Status changed from New to Accepted
- Assigned to set to leo
- Target version set to 2.8.2
Unfortunately, it is not really working great. What if someone wants to use the navigation menu as submenu? Then it should be hidden if a page outside the trail is viewed, right? So maybe we need to check for $this->startLevel > 0.
Updated by winanscreative 6 months ago
Yes... But if someone is using it as a submenu, then wouldn't they NOT use a reference page. At least that's how I was setting up submenus, so that it would simply use the page it was on as the reference. I thought that was the whole point of the reference page option...
Updated by leo 6 months ago
Apparently, people did try to set a start/stop level, which is why the bugfix has been added in the first place.
Updated by winanscreative 6 months ago
I can understand setting a start/stop level to use a submenu, but then why would they set a reference page? If they didn't then the menu would always consider things based on the current page.
The only reason I can see to constrict it to not displaying outside of the reference page would be if they wanted to make it sitewide on a page layout, but not displaying submenus in some areas. In that case I usually just set up another nav module and create a separate page layout.
I guess it all depends on your workflow. Perhaps a simple "Restrict to Page Trail" option would suffice?
Updated by andreas.schempp 6 months ago
I think we should just test for start/stop level. If it's set, behave like a submenu, otherwise just display all of the reference page trail.
Updated by winanscreative 6 months ago
I disagree. I have many sites set up where I am setting the reference page PLUS the start/stop level in my nav module, and I need the menu to display throughout the entire website. I think the way to give people maximum flexibility is to give them the option to restrict the scope to the reference page.
Maybe I am just setting up my site structure a little differently than what most people are used to, but I think it makes sense. I think a simple checkbox option would account for most of the possibilities one would need.
Unless I am totally missing something here, which could be the case... :)
Updated by leo 6 months ago
I guess we will just revert the change. If you define a reference page, you simply cannot (because you do not need to) define a start level but only a stop level. If someone wants to use the module as main navigation, he does not need to define a start level, and if someone wants to use it as submenu, he does not need to define a reference page. I cannot think of a real scenario where you would need both a reference page and a start level, but just to be sure, I have asked the author of the initial bug report to explain his situation.
Updated by winanscreative 6 months ago
You're right... I stand corrected. I have instances where I am setting the stop level with a reference page, but not the start level, because that wouldn't make sense. Sorry for the confusion!
Updated by leo 6 months ago
It is actually the initial request that confuses me, not your comments :D
Updated by markus.milkereit 6 months ago
Yes, please revert it (had to change some pages after the update on Sunday). I'm with winanscreative here, I often use "container"-pages, which helps to organize big structures (also: access rights etc.), they work in 2.8.1 with the "old" ModuleNavigation.php from 2.8.0.
Updated by webdecker 6 months ago
I had some problems after updating to 2.8.1, too. Would as well appreciate if it will be reverted.
Updated by Sares 6 months ago
Hi Leo,
I have the same problem. After the upgrade to 2.8.1 my meta navigation is not shown anymore.
I have the following site-structure:
home
meta
- meta 1
- meta 2
...
The meta page is hidden in the menu and not published (but it doesn't make any difference what setting I choose here).
The navigation module is configured like this:
Startlevel: 0
Stoplevel: 0
Hard Limit: activated (makes no difference if I change this)
Reference page: meta
This is my setup and the meta navigation is not shown anymore (in 2.7.6 it works without problems).
I have also added the patch you have posted above, but it doesn't work. Afterwards I copied the ModuleNavigation.php from 2.8.0, as mentioned above, but nothing happened.
Is there another "hot-fix" to test? Would be great!
If you need some more information on my setup please let me know.
Kind regards,
Sares
Updated by davor 6 months ago
yes i can also confirm problems with module navigation as described here (start,stop level and ref. page)
i think the most important is that it is backward compatible and as flexible as it should be
Updated by Logan 6 months ago
Experiencing the same issue. It's very important to have this fixed, as our entire site is based on Modules using the functionality described here. Until it is fixed, our site is broken. I'm a little uncomfortable with going in and editing code files, but I will in this case.
I added the snippet of code above and it appears to be working, just for reference, here's what the code looks like:
// Overwrite with a custom reference page
if ($this->defineRoot && $this->rootPage > 0)
{
$trail = array();
$blnFound = false;
// Check whether the reference page is within the trail
foreach ($objPage->trail as $id)
{
if ($id == $this->rootPage)
{
$blnFound = true;
}
if ($blnFound)
{
$trail[] = $id;
}
}
if (!$found)
{
$trail = array($this->rootPage);
$level = 0;
}
}
Did I do it correctly? I noticed that in the example winanscreative gave above, his snippet was slightly different. His was this: if (!$blnFound) instead of this (what Leo first posted): if (!$found)
I used Leo's version.
Another question, will this quick fix cause any problems with any future updates?
Thanks!
~Logan
Updated by tosca 6 months ago
Just reported this problem in the forum http://www.typolight-community.org/viewtopic.php?f=6&t=1354&p=5511#p5509 before finding this ticket.
Any idea when this could be fixed?
Also available in: Atom