function PathLocator::getWebRoot

Returns the path of the Drupal installation, relative to the project root.

Return value

string The path of the Drupal installation, relative to the project root and without leading or trailing slashes. Will return an empty string if the project root and Drupal root are the same.

File

core/modules/package_manager/src/PathLocator.php, line 75

Class

PathLocator
Computes file system paths that are needed to stage code changes.

Namespace

Drupal\package_manager

Code

public function getWebRoot() : string {
    $web_root = str_replace(trim($this->getProjectRoot(), DIRECTORY_SEPARATOR), '', trim($this->appRoot, DIRECTORY_SEPARATOR));
    return trim($web_root, DIRECTORY_SEPARATOR);
}

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