murph-core/src/core/DependencyInjection/Compiler/BuilderBlockPass.php
Simon Vieille 232b92267e
add build block loader
add builder block rendering

fix issues with components
2024-05-12 22:24:51 +02:00

26 lines
824 B
PHP

<?php
namespace App\Core\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use App\Core\BuilderBlock\BuilderBlockContainer;
class BuilderBlockPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->has(BuilderBlockContainer::class)) {
return;
}
$definition = $container->findDefinition(BuilderBlockContainer::class);
$taggedServices = $container->findTaggedServiceIds('builder_block.widget');
foreach ($taggedServices as $id => $tags) {
$definition->addMethodCall('addWidget', [new Reference($id)]);
}
}
}