You are here

protected static function ScriptHandler::getDrupalRoot in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8

Same name and namespace in other branches
  1. 8.4 src/composer/ScriptHandler.php \Varbase\composer\ScriptHandler::getDrupalRoot()
  2. 8.5 src/composer/ScriptHandler.php \Varbase\composer\ScriptHandler::getDrupalRoot()
  3. 8.6 src/composer/ScriptHandler.php \Varbase\composer\ScriptHandler::getDrupalRoot()
  4. 8.7 src/composer/ScriptHandler.php \Varbase\composer\ScriptHandler::getDrupalRoot()
  5. 9.0.x src/composer/ScriptHandler.php \Varbase\composer\ScriptHandler::getDrupalRoot()

Get the Drupal root directory.

Parameters

string $project_root: Project root.

Return value

string Drupal root path.

3 calls to ScriptHandler::getDrupalRoot()
ScriptHandler::createRequiredFiles in src/composer/ScriptHandler.php
Create required files.
ScriptHandler::postDrupalScaffoldProcedure in src/composer/ScriptHandler.php
Post Drupal Scaffold Procedure.
ScriptHandler::removeGitDirectories in src/composer/ScriptHandler.php
Remove .git folder from modules, themes, profiles of development branches.

File

src/composer/ScriptHandler.php, line 24

Class

ScriptHandler
Varbase Composer Script Handler.

Namespace

Varbase\composer

Code

protected static function getDrupalRoot($project_root) {
  $fs = new Filesystem();
  $drupalFinder = new DrupalFinder();
  $drupalFinder
    ->locateRoot(getcwd());
  $drupalRoot = $drupalFinder
    ->getDrupalRoot();
  if (!$fs
    ->exists($drupalRoot . '/core')) {
    return $project_root . '/docroot';
  }
  else {
    return $drupalRoot;
  }
}