I was asked to redo a GRAV site that I built previously using customised Learn2 template. The new template should be X-corporation.
I had a certain suspicion that it would not be a piece of cake, but the task seems even trickier. The most pressing issue is that the drop-down menus at the top of the page do not work. To be exact - they drop a white rectangle but it does not contain anything. This is the page code:
These two empty list items should contain subdirectories names, right? (At least this is how it worked it Learn2.) Anyway, the structure of directory student is as follows:
I installed the skeleton for X-corporation, upgraded everything using bin/gpm selfupgrade and bin/gpm update and installed admin using bin/gpm install admin.
Everything is working just fineβ¦
First thought:
Using the browser, can you check if the list elements for the dropdown menu are being created? Something like:
@tacuarimedia Iβm not sure if your issue is the same as the issue mentioned by OP.
Nevertheless, I installed a fresh Grav and created a βpure-blankβ theme. Guess whatβ¦ the submenu doesnβt workβ¦
I think the reason is an error in navigation.html.twig on line 26:
{% if theme_config.dropdown.enabled %}
When I dump the variable theme_config it appears not to be defined (null). When using variables config.theme or theme to access the configuration for the theme, proper values are returned and the submenu works.
Solution: (For pure-blank theme only)
Change line 26 of navigation.html.twig into:
{% if config.theme.dropdown.enabled %}
or the shorthand
{% if theme.dropdown.enabled %}
Problem has been introduced last June when updating base.html.twig. Iβve added a comment on that commit for the devs to fix.
Pamtbau, thanks for your time and effort. Starting with fresh grav installation was a briliant idea (I have reinstalled grav a couple of times by now and I am getting really good at that )
The problem with the empty drop-down menu - i. e. items actually rendered on the pages but empty - is cause by X-corporationβs menu philosophy, as I found out by trial and error (lots of errors ). This behaviour might seem normal to those who have experience with different grav templates than Learn2 but it caused nightmares to me.
The solution for a working drop-down menu - if anyone ever encounters the same problem - is viewing the top folders as captions for the columns which will be rendered. Only the subfolders that one places within these 1-5 main folders (aka columns of the menu) will be visible on the page and clickable. This is the correct folder structure (as opposed to the one derived form Learn2 in the original post):