CorsCompilerPass.php in Drupal 10
File
core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php
View source
<?php
namespace Drupal\Core\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CorsCompilerPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
$enabled = FALSE;
if ($cors_config = $container
->getParameter('cors.config')) {
$enabled = !empty($cors_config['enabled']);
}
if (!$enabled) {
$container
->removeDefinition('http_middleware.cors');
}
}
}
Classes
Name |
Description |
CorsCompilerPass |
Provides a compiler pass which disables the CORS middleware in case disabled. |