/** * Registers all libraries that have an "xautoload" setting. */ private function registerAllLibraries() { $adapter = \xautoload_InjectedAPI_hookXautoload::create($this->finder, ''); foreach ($info = $this->getLibrariesXautoloadInfo() as $name => $pathAndCallback) { list($path, $callback) = $pathAndCallback; if (!is_callable($callback)) { continue; } if (!is_dir($path)) { continue; } $adapter->setExtensionDir($path); call_user_func($callback, $adapter, $path); } }
/** * Runs hook_xautoload() on all enabled modules. * * This may occur multiple times in a request, if new modules are enabled. * * @param array $modules */ private function runHookXautoload(array $modules) { // Let other modules register stuff to the finder via hook_xautoload(). $adapter = \xautoload_InjectedAPI_hookXautoload::create($this->finder, ''); foreach ($modules as $module) { $adapter->setExtensionDir($dir = $this->system->drupalGetPath('module', $module)); $function = $module . '_xautoload'; $function($adapter, $dir); } }
/** * Executes the operation. * * This method will only be called if and when the "real" class finder is * initialized. * * @param ExtendedClassFinderInterface $finder * The class finder. */ function cacheMiss($finder) { $adapter = \xautoload_InjectedAPI_hookXautoload::create($finder, $this->path); call_user_func($this->callable, $adapter, $this->path); }