You are here

function hook_xautoload in X Autoload 7.2

Same name and namespace in other branches
  1. 7.5 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

xautoload_InjectedAPI_hookXautoload $api:

Object with a number of methods, which are documented at the class definition of xautoload_InjectedAPI_hookXautoload.

The object already knows which module we are at, so we don't need drupal_get_path().

TODO: The $api object should be specified by an interface.

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.

libraries_xautoload in ./xautoload.module
Implements hook_xautoload on behalf of libraries module
1 invocation of hook_xautoload()
xautoload_custom_theme in ./xautoload.module
Implements hook_custom_theme() We only do this because that's the first hook to fire after bootstrap.

File

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

Code

function hook_xautoload($api) {

  // Declare a foreign namespace in (module dir)/lib/ForeignNamespace/
  $api
    ->namespaceRoot('ForeignNamespace');

  // Declare a foreign namespace in (module dir)/vendor/ForeignNamespace/
  $api
    ->namespaceRoot('ForeignNamespace', 'vendor');

  // Declare a foreign namespace in /home/username/lib/ForeignNamespace/,
  // setting the $relative argument to FALSE.
  $api
    ->namespaceRoot('ForeignNamespace', '/home/username/lib', FALSE);
}