function ServerCommand::getSitePath

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Command/ServerCommand.php \Drupal\Core\Command\ServerCommand::getSitePath()
  2. 10 core/lib/Drupal/Core/Command/ServerCommand.php \Drupal\Core\Command\ServerCommand::getSitePath()
  3. 11.x core/lib/Drupal/Core/Command/ServerCommand.php \Drupal\Core\Command\ServerCommand::getSitePath()

Gets the site path.

Defaults to 'sites/default'. For testing purposes this can be overridden using the DRUPAL_DEV_SITE_PATH environment variable.

Return value

string The site path to use.

1 call to ServerCommand::getSitePath()
ServerCommand::boot in core/lib/Drupal/Core/Command/ServerCommand.php
Boots up a Drupal environment.

File

core/lib/Drupal/Core/Command/ServerCommand.php, line 273

Class

ServerCommand
Runs the PHP webserver for a Drupal site for local testing/development.

Namespace

Drupal\Core\Command

Code

protected function getSitePath() {
    return getenv('DRUPAL_DEV_SITE_PATH') ?: 'sites/default';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.