You are here

function LibrariesInfo::getLibrariesInfo in X Autoload 7.5

Parameters

string|null $name:

Return value

mixed

See also

libraries_info()

File

tests/src/VirtualDrupal/LibrariesInfo.php, line 35

Class

LibrariesInfo

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

function &getLibrariesInfo($name = NULL) {

  // This static cache is re-used by libraries_detect() to save memory.
  $libraries =& $this->drupalStatic
    ->get('libraries_info');
  if (!isset($libraries)) {
    $libraries = array();

    // Gather information from hook_libraries_info().
    foreach ($this->hookSystem
      ->moduleImplements('libraries_info') as $module) {
      foreach (PureFunctions::moduleInvoke($module, 'libraries_info') as $machine_name => $properties) {
        $properties['module'] = $module;
        $libraries[$machine_name] = $properties;
      }
    }

    // Gather information from hook_libraries_info() in enabled themes.
    // @see drupal_alter()
    // SKIPPED
    // Gather information from .info files.
    // .info files override module definitions.
    // SKIPPED
    // Provide defaults.
    foreach ($libraries as $machine_name => &$properties) {
      $this
        ->librariesInfoDefaults($properties, $machine_name);
    }

    // Allow modules to alter the registered libraries.
    $this->hookSystem
      ->drupalAlter('libraries_info', $libraries);

    // Invoke callbacks in the 'info' group.
    // SKIPPED
  }
  if (isset($name)) {
    if (!empty($libraries[$name])) {
      return $libraries[$name];
    }
    else {
      $false = FALSE;
      return $false;
    }
  }
  return $libraries;
}