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

Added a new section to the page templating/global_vars using a EVListener #6794

Closed
wants to merge 9 commits into from

Conversation

appeltaert
Copy link
Contributor

Added another option for injecting variables into templates through the use of a event listener, also added a DC/removal notice on twigs getGlobals

@appeltaert appeltaert closed this Jul 30, 2016
@appeltaert appeltaert reopened this Jul 30, 2016
@appeltaert
Copy link
Contributor Author

appeltaert commented Jul 30, 2016

Ok, if anyone wants to help me out on this syntax error please.. I see no problems.


If you're using the `@Template`_ annotation from `SensioFrameworkExtraBundle`_ you can hook
into ``kernel.view`` right before the template listener kicks in, take a look at the
dedicated page about :doc:`Event Listeners </event_dispatcher.html>`_.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax error is caused by the underscore at the end of the :doc: link.
Something like this is fine:

page about :doc:`/event_dispatcher`.

@snoek09
Copy link

snoek09 commented Jul 31, 2016

👍

Status: Reviewed

Thanks @appeltaert

@appeltaert appeltaert changed the title Added the new section and a DC notice Added a new section to the page templating/global_vars using a EVListener Jul 31, 2016
@appeltaert
Copy link
Contributor Author

done, thanks @snoek09

@weaverryan
Copy link
Member

Hey @appeltaert!

Thanks for opening this. Unfortunately, I don't like the solution - because it won't work for most people (and even for people that use @Template, it won't work if they have some templates that don't use this :).

But, you're 100% right that getGlobals() is deprecated and so we need to stop recommending it! I think we should just remove this entire Using a Twig Extension section. I think the previous config section is flexible enough, as you can inject entire services as global variables if you really need to.

Could you make that change?

Thanks!

@weaverryan
Copy link
Member

Status: Needs Work

@appeltaert
Copy link
Contributor Author

@weaverryan looking at it that way i agree, ill keep that in mind for future contribs. something like this has more legitimacy for stackoverflow.

sure, ill do the change

@xabbuh
Copy link
Member

xabbuh commented Aug 3, 2016

👍

Status: Reviewed

@wouterj
Copy link
Member

wouterj commented Aug 11, 2016

Thanks for keeping the docs in sync with latest Twig changes Piet! It's now merged into the 2.7 version (I'll merge it into newer versions from there)

wouterj added a commit that referenced this pull request Aug 11, 2016
…ing a EVListener (piet, Piet Bijl)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #6794).

Discussion
----------

Added a new section to the page templating/global_vars using a EVListener

Added another option for injecting variables into templates through the use of a event listener, also added a DC/removal notice on twigs getGlobals

Commits
-------

ef1c2fd Added a new section to the page templating/global_vars using a EVListener
@wouterj wouterj closed this Aug 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants