class CorsCompilerPass
Same name in other branches
- 9 core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass
- 10 core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass
- 11.x core/lib/Drupal/Core/DependencyInjection/Compiler/CorsCompilerPass.php \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass
Provides a compiler pass which disables the CORS middleware in case disabled.
Hierarchy
- class \Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
Expanded class hierarchy of CorsCompilerPass
See also
1 file declares its use of CorsCompilerPass
- CoreServiceProvider.php in core/
lib/ Drupal/ Core/ CoreServiceProvider.php
File
-
core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ CorsCompilerPass.php, line 13
Namespace
Drupal\Core\DependencyInjection\CompilerView source
class CorsCompilerPass implements CompilerPassInterface {
/**
* {@inheritdoc}
*/
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');
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
CorsCompilerPass::process | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.