You are here

function libraries_info_defaults in Libraries API 8.3

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

Deprecated

Will be removed before a stable Drupal 8 release. Please use the new library load and managment concepts described at: https://www.drupal.org/node/2170763

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

File

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

Code

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

  // 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;
}