function Drupal::hasService
Same name in other branches
- 8.9.x core/lib/Drupal.php \Drupal::hasService()
- 10 core/lib/Drupal.php \Drupal::hasService()
- 11.x core/lib/Drupal.php \Drupal::hasService()
Indicates if a service is defined in the container.
Parameters
string $id: The ID of the service to check.
Return value
bool TRUE if the specified service exists, FALSE otherwise.
18 calls to Drupal::hasService()
- ExtensionDiscovery::scan in core/
lib/ Drupal/ Core/ Extension/ ExtensionDiscovery.php - Discovers available extensions of a given type.
- FormBuilder::currentUser in core/
lib/ Drupal/ Core/ Form/ FormBuilder.php - Gets the current active user.
- InfoParserDynamic::__construct in core/
lib/ Drupal/ Core/ Extension/ InfoParserDynamic.php - InfoParserDynamic constructor.
- ModuleInstaller::install in core/
lib/ Drupal/ Core/ Extension/ ModuleInstaller.php - Installs a given list of modules.
- module_load_include in core/
includes/ module.inc - Loads a module include file.
File
-
core/
lib/ Drupal.php, line 219
Class
- Drupal
- Static Service Container wrapper.
Code
public static function hasService($id) {
// Check hasContainer() first in order to always return a Boolean.
return static::hasContainer() && static::getContainer()->has($id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.