W3cubDocs

/Drupal 8

function drupal_classloader_register

drupal_classloader_register($name, $path)

Registers an additional namespace.

Parameters

string $name: The namespace component to register; e.g., 'node'.

string $path: The relative path to the Drupal component in the filesystem.

File

core/includes/bootstrap.inc, line 754
Functions that need to be loaded on every Drupal request.

Code

function drupal_classloader_register($name, $path) {
  $loader = \Drupal::service('class_loader');
  $loader->addPsr4('Drupal\\' . $name . '\\', \Drupal::root() . '/' . $path . '/src');
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!bootstrap.inc/function/drupal_classloader_register/8.1.x