What are the programmatic steps to turn this string:
AcmeProjectBundle::home.html.twig
into this?
/path/Symfony/src/Acme/ProjectBundle/Resources/views/home.html.twig
If you want to retrieve path from a controller you can use this code:
$parser = $this->container->get('templating.name_parser');
$locator = $this->container->get('templating.locator');
$path = $locator->locate($parser->parse('AcmeProjectBundle::home.html.twig'));
For more info take a look at code of:
Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser::parse
Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator::locate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With