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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Config.theme empty

first-time

Solved by pamtbaau View solution

Started by Brian McWilliams 7 years ago · 2 replies · 507 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 Thomas, 1 week ago
2 64 18 hours ago
Support · by Anna, 3 days ago
2 68 20 hours ago
Support · by Justin Young, 21 hours ago
1 35 21 hours ago
Support · by Duc , 1 week ago
2 71 6 days ago
Support · by Colin Hume, 1 week ago
2 63 6 days ago