function ControllerBase::container
Same name in other branches
- 9 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::container()
- 8.9.x core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::container()
- 10 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::container()
Returns the service container.
This method is marked private to prevent sub-classes from retrieving services from the container through it. Instead, \Drupal\Core\DependencyInjection\ContainerInjectionInterface should be used for injecting services.
Return value
\Symfony\Component\DependencyInjection\ContainerInterface The service container.
File
-
core/
lib/ Drupal/ Core/ Controller/ ControllerBase.php, line 284
Class
- ControllerBase
- Utility base class for thin controllers.
Namespace
Drupal\Core\ControllerCode
private function container() {
return \Drupal::getContainer();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.