SitePathFactory.php in Drupal 9
Same filename and directory in other branches
Namespace
Drupal\CoreFile
core/lib/Drupal/Core/SitePathFactory.phpView source
<?php
namespace Drupal\Core;
/**
* Gets the site path from the kernel.
*/
class SitePathFactory {
/**
* The Drupal kernel.
*
* @var \Drupal\Core\DrupalKernelInterface
*/
protected $drupalKernel;
/**
* Constructs a 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
->getContainer()
->getParameter('site.path');
}
}
Classes
Name | Description |
---|---|
SitePathFactory | Gets the site path from the kernel. |