DrupalExtensionLibPSR0.php in X Autoload 7.2
File
lib/Plugin/DrupalExtensionLibPSR0.phpView source
<?php
class xautoload_Plugin_DrupalExtensionLibPSR0 extends xautoload_Plugin_WithKillswitch {
protected $system;
/**
* @param xautoload_DrupalExtensionSystem $system
* Abstraction of Drupal's extension system.
*/
function __construct($system) {
$this->system = $system;
}
/**
* 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.
*
* @param xautoload_InjectedAPI_findFile $api
* API object with suggestFile() method.
* @param string $Drupal_string
* The way we register this plugin, this parameter will always be a string
* with value "Drupal/".
* @param 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 boolean
* TRUE, if we found it.
*/
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;
}
}
}
}
}
Classes
Name | Description |
---|---|
xautoload_Plugin_DrupalExtensionLibPSR0 |