public static function Drupal::setContainer in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal.php \Drupal::setContainer()
Sets a new global container.
Parameters
\Symfony\Component\DependencyInjection\ContainerInterface $container: A new container instance to replace the current.
202 calls to Drupal::setContainer()
- AccessManagerTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php - AccessResultTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php - ActiveWorkspaceCheckTest::setUp in core/
modules/ workspaces/ tests/ src/ Unit/ ActiveWorkspaceCheckTest.php - AjaxRendererTest::testConstructorRendererArgument in core/
tests/ Drupal/ Tests/ Core/ Controller/ AjaxRendererTest.php - @group legacy @expectedDeprecation The renderer service must be passed to Drupal\Core\Render\MainContent\AjaxRenderer::__construct and will be required before Drupal 9.0.0. See https://www.drupal.org/node/3009400
- BaseFieldDefinitionTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Entity/ BaseFieldDefinitionTest.php
File
- core/
lib/ Drupal.php, line 110 - Contains \Drupal.
Class
- Drupal
- Static Service Container wrapper.
Code
public static function setContainer(ContainerInterface $container) {
static::$container = $container;
}