Implement libraries_library(), so that modules that work with Libraries API can use their libraries (via drupal_add_library()) without having to implement their own hook_library().

<?php
/**
* Implement hook_libraries_info().
*/
function tinymce_libraries_info() {
 
$libraries['tinymce'] = array(
   
'files' => array(
     
'js' => 'tinymce.js',
     
'css' => 'tinymce.css',
    ),
  );
}
// Now to add TinyMCE's JS/CSS, you can do the following...
drupal_add_library('libraries', 'tinymce');
$form['myelement']['#attached'][] = array('libraries', 'tinymce');
?>

Comments

The problem is that we can only register libraries that are installed. So we would have to detect all libraries in libraries_library(). That would currently be a performance hit, because we only cache libraries_load() currently.
Of course we could cache libraries_detect(), but I don't think that is necessary.
It is neither tested nor documented, but in theory we already support '#attached' anyway. So instead of your example, you can do:

<?php
/**
* Implement hook_libraries_info().
*/
function tinymce_libraries_info() {
 
$libraries['tinymce'] = array(
   
'files' => array(
     
'js' => 'tinymce.js',
     
'css' => 'tinymce.css',
    ),
  );
}
// Now to add TinyMCE's JS/CSS, you can do the following...
libraries_load('tinymce');
$form['myelement']['#attached']['libraries_load'][] = array('tinymce');
?>

Status:Active» Postponed

Before attempting to do this, I want to see how generic something like this can be in the first place.

Based on the initial code for http://drupal.org/project/jquery, I somewhat doubt there's anything generic here.

Lastly, (I know I'm repeating myself ;) bear in mind that hook_library() is fundamentally different to Libraries API. The potential overlap with hook_library() only exists for 1:1 library-to-module relationships.

Issue summary:View changes
Status:Postponed» Active

Re-opening based on #2167021: Revamp Libraries API integration

The important use-case that was not mentioned is declaring Libraries API libraries as dependencies of non-Libraries API libraries. I.e. if my mymodule.admin system library wants to depend on Backbone.js, which is registered with Libraries API.