<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\Bundle\Connect;
use Ibexa\Bundle\Connect\DependencyInjection\Compiler\BlockCompilerPass;
use Ibexa\Bundle\Connect\DependencyInjection\Configuration\SiteAccessAware\ConnectParser;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\Bundle\Bundle;
final class IbexaConnectBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
$loader = new YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/Resources/config')
);
if ($container->hasExtension('ibexa_form_builder')) {
$loader->load('bridge/form_builder.yaml');
}
if ($container->hasExtension('ibexa_fieldtype_page')) {
$loader->load('bridge/page_builder.yaml');
$container->addCompilerPass(new BlockCompilerPass());
}
if ($container->hasExtension('ibexa_connector_ai')) {
$loader->load('services/ai.yaml');
}
/** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $ibexaExtension */
$ibexaExtension = $container->getExtension('ibexa');
$ibexaExtension->addConfigParser(new ConnectParser());
$ibexaExtension->addDefaultSettings(__DIR__ . '/Resources/config', ['default_settings.yaml']);
}
}