Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By VanLuda on
Hello Everyone,
This is my very first time using Drupal and I'm new to twig so I'm trying to figure this stuff out. I can't seem to find an answer to my problem though.
I'm using the foundation 6 framework and it has the logo as a list item in the menu. So I hard code the list item in the menu--main.html.twig but when I try to use {{ site_name }} or {{ site_slogan }} the values are null. I'm not sure why these are null because they work in the block--system-branding-block.html.twig file.
Could someone please take a moment to educate me, I'd appreciate it.
Thank you in advanced,
Carl
Comments
...
Those variables are not available to menu templates, but you can get them from config in preprocess and make them available by setting them into a variable.
Not all variables are available universally (out of the box) in all templates, that would be mean a lot of pointless redundancy.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
Thank you Jeff
Thank you Jeff