Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Config.theme empty

first-time

Solved by pamtbaau View solution

Started by Brian McWilliams 7 years ago · 2 replies · 561 views
7 years ago

I'm trying to access values from config.theme from within partials/navigation.html.twig

Just debugging and trying to display the values. These all display empty. You'd think at least dump(config.theme) would display something. Empty. What am I doing wrong?

{% set theme_config = attribute(config.themes, config.system.pages.theme) %}

theme_config: {{ dump(theme_config) }}<br>

config theme: {{ dump(config.theme) }}<br>

theme dropdown: {{ theme_config.dropdown.enabled }}<br>

latierra dropdown: {{ latierra.dropdown.enabled }}<br>

dropdown: {{ dropdown.enabled }}<br>

7 years ago Solution

@bmcwilliams, Because of the labels you are using, my first guess is that you expect to see the dumps in the resulting Html.

However, unlike {{ var_dump() }}, {{ dump() }} does not display its results in the resulting Html page, but instead in the DebugBar which is shown in the browser like the 'Developer Tools' window.

To display the DebugBar, you have to enable debugging in /user/config/system.yaml:

YAML
debugger:
  enabled: true

You can find more information in the documentation on Debugging & Logging

Hope this helps...

7 years ago

Yes, you're exactly right. I wrongly assumed that dump() displays results in the HTML. var_dump() displays results in HTML as you stated and I was able to track bugs this way. Thank you!

Suggested topics

Topic Participants Replies Views Activity
Support · by BenLaKnet, 5 days ago
1 123 2 days ago
Support · by BenLaKnet, 1 week ago
5 195 2 days ago
Support · by kskt, 3 days ago
0 45 3 days ago
Support · by David Meissner, 3 days ago
0 45 3 days ago
Support · by David Meissner, 4 days ago
3 92 3 days ago