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

add twig constant for defining template namespace #991

Open
Davidmattei opened this issue Aug 21, 2024 · 2 comments
Open

add twig constant for defining template namespace #991

Davidmattei opened this issue Aug 21, 2024 · 2 comments
Assignees

Comments

@Davidmattei
Copy link
Member

No description provided.

@Davidmattei
Copy link
Member Author

Davidmattei commented Sep 27, 2024

This looks easy, but its not.

\EMS\CoreBundle\DependencyInjection\EMSCoreExtension

    public function prepend(ContainerBuilder $container): void
    {
        ....
        $globals = [
            ....
            'templateNamespace' => $configs[0]['template_namespace'] ?? Configuration::TEMPLATE_NAMESPACE,
        ];

So in a custom dashboard:

{%- extends "@#{templateNamespace}/components/json_menu_nested/template.twig" -%}

Results in: Variable "templateNamespace" does not exist.

I do not understand because we can use dynamic inheritance: https://twig.symfony.com/doc/3.x/tags/extends.html#dynamic-inheritance

@theus77
Copy link
Member

theus77 commented Sep 28, 2024

I also tried without success.

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

No branches or pull requests

2 participants