function CorsCompilerPass::process
Same name in other branches
- 8.9.x core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass::process()
- 10 core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass::process()
- 11.x 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');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.