You are here

function xautoload_Plugin_DrupalExtensionLibPSR0::findFile in X Autoload 7.2

The way this plugin is registered, it will only ever be called if the class is within the \Drupal\ namespace. All the DIRECTORY_SEPARATOR in the $path parameter were namespace separators before.

Parameters

xautoload_InjectedAPI_findFile $api: API object with suggestFile() method.

string $Drupal_string: The way we register this plugin, this parameter will always be a string with value "Drupal/".

string $path: The part of the PSR-0 path after "Drupal/". E.g., if the class is "Drupal\ab_cd\SomeClass", then this will be "ab_cd/SomeClass.php".

Return value

boolean TRUE, if we found it.

Overrides xautoload_Plugin_Interface::findFile

File

lib/Plugin/DrupalExtensionLibPSR0.php, line 33

Class

xautoload_Plugin_DrupalExtensionLibPSR0

Code

function findFile($api, $Drupal_string, $path) {
  $pos = strpos($path, DIRECTORY_SEPARATOR);
  if (FALSE !== $pos) {
    $extension = substr($path, 0, $pos);
    $extension_path = $this->system
      ->getExtensionPath($extension);
    if (!empty($extension_path)) {
      $path = $extension_path . '/lib/Drupal/' . $path;
      if ($api
        ->suggestFile($path)) {
        return TRUE;
      }
    }
  }
}