function _responsive_preview_convert_libraries_to_library in Responsive Theme Preview 7
Converts a libraries module array to a hook_library array.
What is this necessary? I don't see any way from the Libraries module API to get an array that corresponds to what hook_library expects.
1 call to _responsive_preview_convert_libraries_to_library()
- responsive_preview_library in ./
responsive_preview.module  - Implements hook_library().
 
File
- ./
responsive_preview.module, line 536  - Provides a component that previews the a page in various device dimensions.
 
Code
function _responsive_preview_convert_libraries_to_library($library, $options = array()) {
  // If the library wasn't installed, don't bother converting it.
  if (!$library['installed']) {
    return array();
  }
  $converted = array();
  $files = array();
  // Get the library files from one of the installed variants.
  if ($name = _responsive_preview_libraries_get_preferred_variant_name($library)) {
    $files = $library['variants'][$name]['files'];
  }
  // Define the library if files exist for it.
  if (!empty($files)) {
    // This is the basic structure expected by hook_library().
    $converted = array(
      'title' => $library['name'],
      'website' => $library['vendor url'],
      'version' => $library['version'],
    );
    foreach ($files as $type => $paths) {
      foreach ($paths as $filename => $data) {
        $converted[$type][$library['library path'] . '/' . $filename] = $options;
      }
    }
  }
  return $converted;
}