public function CorsCompilerPass::process in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass::process()
- 9 core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass::process()
File
- core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ CorsCompilerPass.php, line 18
Class
- CorsCompilerPass
- Provides a compiler pass which disables the CORS middleware in case disabled.
Namespace
Drupal\Core\DependencyInjection\CompilerCode
public function process(ContainerBuilder $container) {
$enabled = FALSE;
if ($cors_config = $container
->getParameter('cors.config')) {
$enabled = !empty($cors_config['enabled']);
}
// Remove the CORS middleware completely in case it was not enabled.
if (!$enabled) {
$container
->removeDefinition('http_middleware.cors');
}
}