You are here

protected function xautoload_InjectedAPI_hookXautoload::processDir in X Autoload 7.2

Same name and namespace in other branches
  1. 7.5 legacy/lib/InjectedAPI/hookXautoload.php \xautoload_InjectedAPI_hookXautoload::processDir()
  2. 7.3 lib/InjectedAPI/hookXautoload.php \xautoload_InjectedAPI_hookXautoload::processDir()
  3. 7.4 legacy/lib/InjectedAPI/hookXautoload.php \xautoload_InjectedAPI_hookXautoload::processDir()

Process a given directory to make it relative to Drupal root, instead of relative to the current extension dir.

Parameters

string $dir: The directory path that we want to make absolute.

boolean $relative: If TRUE, the $dir will be transformed from relative to absolute. If FALSE, the $dir is assumed to already be absolute, and remain unchanged.

Return value

string The modified (absolute) directory path.

4 calls to xautoload_InjectedAPI_hookXautoload::processDir()
xautoload_InjectedAPI_hookXautoload::namespaceDeep in lib/InjectedAPI/hookXautoload.php
Register an additional namespace for this module. Note: Drupal\<module name>\ is already registered for <module dir>/lib.
xautoload_InjectedAPI_hookXautoload::namespaceRoot in lib/InjectedAPI/hookXautoload.php
Register an additional namespace for this module. Note: Drupal\<module name>\ is already registered for <module dir>/lib.
xautoload_InjectedAPI_hookXautoload::prefixDeep in lib/InjectedAPI/hookXautoload.php
Register an additional namespace for this module. Note: Drupal\<module name>\ is already registered for <module dir>/lib.
xautoload_InjectedAPI_hookXautoload::prefixRoot in lib/InjectedAPI/hookXautoload.php
Register an additional namespace for this module. Note: Drupal\<module name>\ is already registered for <module dir>/lib.

File

lib/InjectedAPI/hookXautoload.php, line 134

Class

xautoload_InjectedAPI_hookXautoload
An instance of this class is passed around to implementations of hook_xautoload().

Code

protected function processDir($dir, $relative) {
  if (!isset($dir)) {
    $dir = $this->extensionDir . '/lib';
  }
  elseif ($relative) {

    // Root dir is relative to module root.
    if (empty($dir)) {
      $dir = $this->extensionDir;
    }
    else {
      $dir = $this->extensionDir . '/' . $dir;
    }
  }
  else {

    // Leave the $dir as it is.
  }
  return $dir;
}