You are here

function hook_xautoload in X Autoload 7.5

Same name and namespace in other branches
  1. 7.2 xautoload.api.php \hook_xautoload()
  2. 7.3 xautoload.api.php \hook_xautoload()
  3. 7.4 xautoload.api.php \hook_xautoload()

Implements hook_xautoload()

Register additional classes, namespaces, autoload patterns, that are not already registered by default.

Parameters

\Drupal\xautoload\Adapter\LocalDirectoryAdapter $adapter: An adapter object that can register stuff into the class loader.

1 function implements hook_xautoload()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

xautoload_test_4_xautoload in tests/test_4/xautoload_test_4.module
Implements hook_xautoload().

File

./xautoload.api.php, line 28
Hooks provided by X Autoload.

Code

function hook_xautoload($adapter) {

  // Register a namespace with PSR-0.
  $adapter
    ->add('Acme\\GardenKit\\', 'shrubbery/lib');

  // Register a namespace with PSR-4.
  $adapter
    ->absolute()
    ->addPsr4('Acme\\ShrubGardens\\', '/home/karnouffle/php/shrub-gardens/src');

  // Scan sites/all/vendor/composer for Composer-generated autoload files, e.g.
  // 'sites/all/vendor/composer/autoload_namespaces.php', etc.
  $adapter
    ->absolute()
    ->composerDir('sites/all/vendor/composer');
}