Skip to content

Commit 0196bcf

Browse files
committed
fix: remove outdated classes
1 parent 760bcb5 commit 0196bcf

3 files changed

Lines changed: 29 additions & 7 deletions

File tree

templates/twig-component/src/DependencyInjection/HtmlTwigComponentExtension.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff 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
}

templates/twig-component/src/HtmlTwigComponentBundle.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Html\TwigComponentBundle;
44

5+
use Symfony\Component\Config\FileLocator;
6+
use Symfony\Component\DependencyInjection\ContainerBuilder;
7+
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
58
use 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
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
_defaults:
3+
autowire: true
4+
autoconfigure: true
5+
6+
Html\TwigComponentBundle\Twig\:
7+
resource: '../../../Twig/'

0 commit comments

Comments
 (0)