class AppRootFactory in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/AppRootFactory.php \Drupal\Core\AppRootFactory
Gets the app root from the kernel.
Hierarchy
- class \Drupal\Core\AppRootFactory
Expanded class hierarchy of AppRootFactory
1 string reference to 'AppRootFactory'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses AppRootFactory
File
- core/
lib/ Drupal/ Core/ AppRootFactory.php, line 8
Namespace
Drupal\CoreView source
class AppRootFactory {
/**
* The Drupal kernel.
*
* @var \Drupal\Core\DrupalKernelInterface
*/
protected $drupalKernel;
/**
* Constructs an AppRootFactory instance.
*
* @param \Drupal\Core\DrupalKernelInterface $drupal_kernel
* The Drupal kernel.
*/
public function __construct(DrupalKernelInterface $drupal_kernel) {
$this->drupalKernel = $drupal_kernel;
}
/**
* Gets the app root.
*
* @return string
* The app root.
*/
public function get() {
return $this->drupalKernel
->getContainer()
->getParameter('app.root');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AppRootFactory:: |
protected | property | The Drupal kernel. | |
AppRootFactory:: |
public | function | Gets the app root. | |
AppRootFactory:: |
public | function | Constructs an AppRootFactory instance. |