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

[Twig Hooks] No @= support in the configuration #11

Open
jakubtobiasz opened this issue May 21, 2024 · 0 comments
Open

[Twig Hooks] No @= support in the configuration #11

jakubtobiasz opened this issue May 21, 2024 · 0 comments
Labels
feature twig hooks Issues and Pull Requests related to Twig Hooks

Comments

@jakubtobiasz
Copy link
Contributor

We can access the configuration and context bags in the context (YAML configuration) with using @=.

Example:

twig_hooks:
	hooks:
		'my_hook':
			template: 'my_template.html.twig'
			context:
				some_key: '@=_context.something'

It will retrieve the value of the something key from the context. The same applies for the _configuration.

Sometimes, we might need to access the context or configuration bag in the configuration.

twig_hooks:
	hooks:
		'my_hook':
			template: 'my_template.html.twig'
			configuration:
				attribute:
					'channel-id': '@=_context.resource.id'

The goal of this issue is to reuse the logic behind the bags resolving while defining the context in the configuration declaration.

@jakubtobiasz jakubtobiasz added twig hooks Issues and Pull Requests related to Twig Hooks feature labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature twig hooks Issues and Pull Requests related to Twig Hooks
Projects
None yet
Development

No branches or pull requests

1 participant