You are here

function libraries_info_defaults in Libraries API 7.3

Same name and namespace in other branches
  1. 8.3 libraries.module \libraries_info_defaults()
  2. 7.2 libraries.module \libraries_info_defaults()

Applies default properties to a library definition.

@library An array of library information, passed by reference. @name The machine name of the passed-in library.

3 calls to libraries_info_defaults()
LibrariesTestCase::testCallbacks in tests/libraries.test
Tests the applying of callbacks.
LibrariesTestCase::testLibrariesInfo in tests/libraries.test
Tests libraries_info().
libraries_info in ./libraries.module
Returns information about registered libraries.

File

./libraries.module, line 485
External library handling for Drupal modules.

Code

function libraries_info_defaults(&$library, $name) {
  $library += array(
    'machine name' => $name,
    'name' => $name,
    'vendor url' => '',
    'download url' => '',
    'path' => '',
    'library path' => NULL,
    'version callback' => 'libraries_get_version',
    'version arguments' => array(),
    'files' => array(),
    'dependencies' => array(),
    'variants' => array(),
    'versions' => array(),
    'integration files' => array(),
    'callbacks' => array(),
  );
  $library['callbacks'] += array(
    'info' => array(),
    'pre-detect' => array(),
    'post-detect' => array(),
    'pre-dependencies-load' => array(),
    'pre-load' => array(),
    'post-load' => array(),
  );

  // Add our own callbacks before any others.
  array_unshift($library['callbacks']['info'], 'libraries_prepare_files');
  array_unshift($library['callbacks']['post-detect'], 'libraries_detect_dependencies');
  return $library;
}