diff --git a/composer.json b/composer.json index 16a7281..1a407f0 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "pcm/bundle-name", - "description": "bundle description", + "name": "pcm/icon-bundle", + "description": "Twig icon bundle", "type": "symfony-bundle", "license": "MIT", @@ -19,7 +19,8 @@ "symfony/dependency-injection": "^6.1", "symfony/framework-bundle": "^6.1", "symfony/yaml": "^6.1", - "symfony/http-client": "^6.1" + "symfony/http-client": "^6.1", + "symfony/twig-bundle": "^6.1" }, "require-dev": { @@ -29,13 +30,13 @@ "autoload": { "psr-4": { - "Pcm\\GeocodeBundle\\": "src/" + "Pcm\\IconBundle\\": "src/" } }, "autoload-dev": { "psr-4": { - "Pcm\\GeocodeBundle\\Tests\\": "tests/" + "Pcm\\IconBundle\\Tests\\": "tests/" } } } diff --git a/config/services.yml b/config/services.yml index 78b1c03..618b7c3 100644 --- a/config/services.yml +++ b/config/services.yml @@ -3,8 +3,12 @@ services: autowire: true autoconfigure: true - pcm_example.example_service: - alias: Pcm\ExampleBundle\Service\ExampleService + pcm_icon.icon_extension: + alias: Pcm\IconBundle\Twig\Functions\IconExtension public: true - Pcm\ExampleBundle\Service\ExampleService: ~ + Pcm\IconBundle\Twig\Functions\IconExtension: + public: false + arguments: + # $dir: + # - '%kernel.project_dir%/public/icons' diff --git a/src/PcmExampleBundle.php b/src/PcmIconBundle.php similarity index 88% rename from src/PcmExampleBundle.php rename to src/PcmIconBundle.php index fba84f2..d2c5edd 100644 --- a/src/PcmExampleBundle.php +++ b/src/PcmIconBundle.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Pcm\ExampleBundle; +namespace Pcm\IconBundle; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -10,7 +10,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\Bundle\AbstractBundle; -class PcmExampleBundle extends AbstractBundle { +class PcmIconBundle extends AbstractBundle { public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void { $loader = new YamlFileLoader($builder, new FileLocator(__DIR__.'/../config/')); diff --git a/src/Twig/Functions/IconExtension.php b/src/Twig/Functions/IconExtension.php new file mode 100644 index 0000000..fea66b6 --- /dev/null +++ b/src/Twig/Functions/IconExtension.php @@ -0,0 +1,25 @@ + ['html'] + ]) + ]; + } +} + + diff --git a/tests/Twig/Functions/IconExtensionTest.php b/tests/Twig/Functions/IconExtensionTest.php new file mode 100644 index 0000000..a45d2fb --- /dev/null +++ b/tests/Twig/Functions/IconExtensionTest.php @@ -0,0 +1,27 @@ +icon = new IconExtension(); + } + + public function testInstanceOf(): void + { + $this->assertInstanceOf(IconExtension::class, $this->icon); + } + +}