question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Namespaced Twig paths not working

See original GitHub issue

Firstly, let me say that this plugin is the very best in terms of Symfony 2 integration and I really enjoy it working with it. Keep up the good work!

There is a small issue with the Twig templates when they are referenced as with their namespaced paths:

in config.yml

twig:
    paths:
        "%kernel.root_dir%/../src/vendor/bundle/Resources/views": core

in the controllers:

return $this->render('@core/path/template.html.twig');

or in the templates:

{% include '@core/path/template.html.twig' %}

This plugin doesn’t recognise the shortcut. Is it a bug or it is not technically possible to parse the configuration to reference the namespace paths?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vbsessacommented, May 25, 2018

Is this issue fixed? I’m still having OPs same problem. Any namespaced path defined in config/packages/twig.yaml are not recognized for autocompletion. As a workaround I have to manually define a namespace and its path in Phpstorm twig config section.

1reaction
lstrojnycommented, Aug 17, 2016

Existing bundles are added automatically. E.g. for the SensioDistributionBundle one can reference templates using @SensioDistribution/path/to/template.html.twig.

@Haehnchen Would fr.adrienbrault.idea.symfony2plugin.TwigHelper be the correct place to start implementing this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use and Register Namespaced Twig Paths - Symfony
A single Twig namespace can be associated with multiple paths. The order in which paths are configured is very important, because Twig will...
Read more >
adding namespaced twig paths - symfony - Stack Overflow
I do, but I want to keep the default templates path, if I remove the dash, I have an other issue saying that...
Read more >
Registering Twig namespaces | Components - Drupal
New in 3.0.0: You can now skip the path to the Twig file if the component is deeply nested in your namespace's path....
Read more >
Bundle twig and namespace "There are no registered paths ...
I can't explain it and I'm not aware of having changed anything but it just started working. Egzona ...
Read more >
Ability to use Twig namespaces in templates {% include ...
It also seem to return the paths in that namespace when i use getPaths(). But in grav I get: Template "@atoms/test.twig" is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found