In its current state, there isn't a way to retrieve all libraries with a given module through drupal_get_library. Module like jQuery Plugin Handler and jQ will need this type of functionality.

Comments

retester2010’s picture

Issue tags: -jQuery, -Libraries

library.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +jQuery, +Libraries

The last submitted patch, library.patch, failed testing.

aspilicious’s picture

This function is completly rewritten, still an issue?

robloach’s picture

Yup, unfortunately. In its current state, we can't get any library information if you don't know the owning module and library name.

aspilicious’s picture

Can you rewrite the patch matching the current function? Please?

sun’s picture

Component: javascript » base system

Rob, can you re-roll this patch? Looks pretty much ready to me.

robloach’s picture

Assigned: robloach » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.46 KB

Bot?

Status: Needs review » Needs work

The last submitted patch, 714382.patch, failed testing.

sun’s picture

Missing argument 2 for drupal_get_library(), called in modules/simpletest/tests/common.test on line 1382

robloach’s picture

Status: Needs work » Needs review
StatusFileSize
new2.57 KB

Whoops, forgot = NULL....

robloach’s picture

StatusFileSize
new2.57 KB

Uhh, whoops * 2.

sun’s picture

Status: Needs review » Needs work
+++ includes/common.inc	16 Sep 2010 16:31:22 -0000
@@ -3983,19 +3983,17 @@ function drupal_add_library($module, $na
+ *   (optional) The name of a registered library to retrieve. If not provided,
+ *   will retrieve all libraries defined by the module.

"By default, all libraries defined by $module are returned."

+++ includes/common.inc	16 Sep 2010 16:31:22 -0000
@@ -3983,19 +3983,17 @@ function drupal_add_library($module, $na
  * @return
  *   The definition of the requested library, if existent, or FALSE.

@return also needs a slight adjustment.

+++ includes/common.inc	16 Sep 2010 16:31:22 -0000
@@ -3983,19 +3983,17 @@ function drupal_add_library($module, $na
- * @todo The purpose of drupal_get_*() is completely different to other page
- *   requisite API functions; find and use a different name.

Why did you remove this? The comment is still valid, so let's keep it.

+++ modules/simpletest/tests/common.test	16 Sep 2010 16:31:22 -0000
@@ -1276,6 +1276,16 @@ class JavaScriptTestCase extends DrupalW
+   * Tests the retrieval of libraries.
+   */
+  function testGetLibrary() {

Don't we have a test for retrieving libraries already? We can add those 4 lines to the existing. No need to setup an entirely new test environment for that.

Powered by Dreditor.

sun’s picture

Also, what happens if you pass a $module that does not implement hook_library()? The test should check that, too.

sun’s picture

Title: Can't retrieve all libraries » Can't retrieve all libraries of a module
Assigned: Unassigned » sun
Status: Needs work » Needs review
StatusFileSize
new3.47 KB

I think I'm going to need this for Libraries API, so here's a complete patch, incorporating all of the above feedback.

robloach’s picture

Status: Needs review » Reviewed & tested by the community

Small patch that adds much needed functionality. Also comes with passing tests! RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Looks like a nice, small, non-BC breaking change to add in some needed functionality. Appreciate the tests, too.

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -jQuery, -Libraries

Automatically closed -- issue fixed for 2 weeks with no activity.