You are here

class SitePathFactory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/SitePathFactory.php \Drupal\Core\SitePathFactory

Gets the site path from the kernel.

Hierarchy

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
site.path.factory in core/core.services.yml
Drupal\Core\SitePathFactory

File

core/lib/Drupal/Core/SitePathFactory.php, line 13
Contains \Drupal\Core\SitePathFactory.

Namespace

Drupal\Core
View 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

Namesort descending Modifiers Type Description Overrides
SitePathFactory::$drupalKernel protected property The Drupal kernel.
SitePathFactory::get public function Gets the site path.
SitePathFactory::__construct public function Constructs an SitePathFactory instance.