File tree Expand file tree Collapse file tree
templates/twig-component/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,17 +20,21 @@ class HtmlTwigComponentExtension extends Extension
2020{
2121 public function load (array $ configs , ContainerBuilder $ container ): void
2222 {
23- $ loader = new PhpFileLoader (
24- $ container ,
25- new FileLocator (\dirname (__DIR__ ) . '/Resources/config ' )
26- );
27-
28- // Load services configuration
29- $ loader ->load ('services.php ' );
3023 }
3124
3225 public function getAlias (): string
3326 {
3427 return 'html_twig_component ' ;
3528 }
29+
30+ public function prepend (ContainerBuilder $ container ): void
31+ {
32+ $ bundlePath = dirname (__DIR__ ); // Gets the bundle's root directory
33+
34+ $ container ->prependExtensionConfig ('twig ' , [
35+ 'paths ' => [
36+ $ bundlePath . '/Resources ' => 'HtmlTwigComponent '
37+ ]
38+ ]);
39+ }
3640}
Original file line number Diff line number Diff line change 22
33namespace Html \TwigComponentBundle ;
44
5+ use Symfony \Component \Config \FileLocator ;
6+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
7+ use Symfony \Component \DependencyInjection \Loader \YamlFileLoader ;
58use Symfony \Component \HttpKernel \Bundle \Bundle ;
69
710/**
@@ -18,4 +21,12 @@ public function getPath(): string
1821 {
1922 return \dirname (__DIR__ );
2023 }
24+
25+ public function build (ContainerBuilder $ container ): void
26+ {
27+ parent ::build ($ container );
28+
29+ $ loader = new YamlFileLoader ($ container , new FileLocator (__DIR__ .'/Resources/config ' ));
30+ $ loader ->load ('services.yaml ' );
31+ }
2132}
Original file line number Diff line number Diff line change 1+ services :
2+ _defaults :
3+ autowire : true
4+ autoconfigure : true
5+
6+ Html\TwigComponentBundle\Twig\ :
7+ resource : ' ../../../Twig/'
You can’t perform that action at this time.
0 commit comments