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