public static function Drupal::service in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal.php \Drupal::service()
Retrieves a service from the container.
Use this method if the desired service is not one of those with a dedicated accessor method below. If it is listed below, those methods are preferred as they can return useful type hints.
Parameters
string $id: The ID of the service to retrieve.
Return value
mixed The specified service.
2 calls to Drupal::service()
- service_container_block_block_info in modules/
utility/ service_container_block/ service_container_block.module - Implements hook_block_info().
- StateIntegrationTest::testState in lib/
Drupal/ service_container/ Tests/ StateIntegrationTest.php
File
- lib/
Drupal.php, line 51 - Contains Drupal 7 foreward compatibility layer for Drupal 8.
Class
- Drupal
- Static Service Container wrapper.
Code
public static function service($id) {
return static::$container
->get($id);
}