public static function 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.

37 calls to Drupal::service()
Action::__construct in drupal/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php
Overrides Entity::__construct().
aggregator_refresh in drupal/core/modules/aggregator/aggregator.module
Checks a news feed for new items.
aggregator_remove in drupal/core/modules/aggregator/aggregator.module
Removes all items from a feed.
Block::__construct in drupal/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php
Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::__construct();
BulkDeleteTest::testDeleteFieldInstance in drupal/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php
Verify that deleting an instance leaves the field data items in the database and that the appropriate Field API functions can operate on the deleted data and instance.

... See full list

File

drupal/core/lib/Drupal.php, line 120
Contains Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function service($id) {
  return static::$container
    ->get($id);
}