Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump is not working in Twig files #3892

Open
kellyjoe256 opened this issue Jan 20, 2025 · 1 comment
Open

Dump is not working in Twig files #3892

kellyjoe256 opened this issue Jan 20, 2025 · 1 comment

Comments

@kellyjoe256
Copy link

Hello,

At my workplace, we currently use WordPress, but I was told by my boss to look at alternatives that we can explore.

I am currently following the documentation for the latest grav, and I am liking it at the moment.

The issue I am currently facing is the twig dump (I am using it in the file default.html.twig) is not working for whatever reason

{% extends 'partials/base.html.twig' %}

{% block content %}
    <pre>{{ dump(page) }}</pre>
    {{ page.content|raw }}
{% endblock %}

I have enabled all the necessary settings in system.yaml as shown below

# ...
twig:
  cache: true 
  debug: true
  auto_reload: true
  autoescape: true
  undefined_functions: false
  undefined_filters: false
  safe_functions: []
  safe_filters: [] filters
  umask_fix: false
# ...
debugger:
  enabled: true
  provider: debugbar
  censored: false
  shutdown:
    close_connection: true

GRAV VERSION

Grav CLI Application 1.7.48

Thanks

@kellyjoe256 kellyjoe256 changed the title Dump is not working for me in Twig files Dump is not working in Twig files Jan 20, 2025
@rhukster
Copy link
Member

Are you sure you made the changes in the correct file? It should be the user/config/system.yaml?

If so, the issue might be that debugbar is incompatible with your theme. Debugbar is based on JQuery and sometimes that doesn't play nice with modern themes. The other option is to try the Clockwork (default) debugger that does not add anything to the page, it communicates with a client to display the debug data: https://learn.getgrav.org/17/advanced/debugging

Grav has many ways to output debug data.. there's {{ dump(foo) }} with uses Grav's debugger, but also {{ vardump(foo) }} which uses Symfony's dump command to dump inline into the HTML. Also I wrote a plugin to integrate Spatie's Ray debugger: https://github.com/trilbymedia/grav-plugin-grav-ray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants