diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-09-24 21:50:19 +0200 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-09-24 21:50:19 +0200 |
commit | 6fd99dba80873c026d71549f6f0175722850c1f0 (patch) | |
tree | 7473ec6d8ce711337e51c52133169663403abcae | |
parent | 80a6aef6b4a5161f72405b9cedd54c955b70ebe9 (diff) | |
download | drupal-6fd99dba80873c026d71549f6f0175722850c1f0.tar.gz drupal-6fd99dba80873c026d71549f6f0175722850c1f0.zip |
- Patch #1286868 by rickmanelius: rename hook_library() and hook_library_alter() to standard pattern.
-rw-r--r-- | includes/common.inc | 12 | ||||
-rw-r--r-- | modules/contextual/contextual.module | 4 | ||||
-rw-r--r-- | modules/locale/locale.module | 4 | ||||
-rw-r--r-- | modules/overlay/overlay.module | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 10 | ||||
-rw-r--r-- | modules/simpletest/tests/common_test.module | 8 | ||||
-rw-r--r-- | modules/system/system.api.php | 8 | ||||
-rw-r--r-- | modules/system/system.module | 4 |
8 files changed, 27 insertions, 27 deletions
diff --git a/includes/common.inc b/includes/common.inc index 268e36bfbd2..849a1581674 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4500,8 +4500,8 @@ function drupal_process_states(&$elements) { * its dependencies could not be added. * * @see drupal_get_library() - * @see hook_library() - * @see hook_library_alter() + * @see hook_library_info() + * @see hook_library_info_alter() */ function drupal_add_library($module, $name, $every_page = NULL) { $added = &drupal_static(__FUNCTION__, array()); @@ -4551,8 +4551,8 @@ function drupal_add_library($module, $name, $every_page = NULL) { * of libraries registered by $module is returned (which may be empty). * * @see drupal_add_library() - * @see hook_library() - * @see hook_library_alter() + * @see hook_library_info() + * @see hook_library_info_alter() * * @todo The purpose of drupal_get_*() is completely different to other page * requisite API functions; find and use a different name. @@ -4562,12 +4562,12 @@ function drupal_get_library($module, $name = NULL) { if (!isset($libraries[$module])) { // Retrieve all libraries associated with the module. - $module_libraries = module_invoke($module, 'library'); + $module_libraries = module_invoke($module, 'library_info'); if (empty($module_libraries)) { $module_libraries = array(); } // Allow modules to alter the module's registered libraries. - drupal_alter('library', $module_libraries, $module); + drupal_alter('library_info', $module_libraries, $module); foreach ($module_libraries as $key => $data) { if (is_array($data)) { diff --git a/modules/contextual/contextual.module b/modules/contextual/contextual.module index 0d6b625e726..0a9fdb18c5c 100644 --- a/modules/contextual/contextual.module +++ b/modules/contextual/contextual.module @@ -36,9 +36,9 @@ function contextual_permission() { } /** - * Implements hook_library(). + * Implements hook_library_info(). */ -function contextual_library() { +function contextual_library_info() { $path = drupal_get_path('module', 'contextual'); $libraries['contextual-links'] = array( 'title' => 'Contextual links', diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 9af706c34bd..6bb697d70b5 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -935,11 +935,11 @@ function locale_css_alter(&$css) { } /** - * Implement hook_library_alter(). + * Implement hook_library_info_alter(). * * Provides the language support for the jQuery UI Date Picker. */ -function locale_library_alter(&$libraries, $module) { +function locale_library_info_alter(&$libraries, $module) { global $language; if ($module == 'system' && isset($libraries['system']['ui.datepicker'])) { $datepicker = drupal_get_path('module', 'locale') . '/locale.datepicker.js'; diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module index 9af18e18e5b..6e137b74873 100644 --- a/modules/overlay/overlay.module +++ b/modules/overlay/overlay.module @@ -194,9 +194,9 @@ function overlay_exit() { } /** - * Implements hook_library(). + * Implements hook_library_info(). */ -function overlay_library() { +function overlay_library_info() { $module_path = drupal_get_path('module', 'overlay'); // Overlay parent. diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 5f696733ebc..d7c3b055051 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -1401,14 +1401,14 @@ class JavaScriptTestCase extends DrupalWebTestCase { /** * Adds a JavaScript library to the page and alters it. * - * @see common_test_library_alter() + * @see common_test_library_info_alter() */ function testLibraryAlter() { // Verify that common_test altered the title of Farbtastic. $library = drupal_get_library('system', 'farbtastic'); $this->assertEqual($library['title'], 'Farbtastic: Altered Library', t('Registered libraries were altered.')); - // common_test_library_alter() also added a dependency on jQuery Form. + // common_test_library_info_alter() also added a dependency on jQuery Form. drupal_add_library('system', 'farbtastic'); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'misc/jquery.form.js'), t('Altered library dependencies are added to the page.')); @@ -1417,7 +1417,7 @@ class JavaScriptTestCase extends DrupalWebTestCase { /** * Tests that multiple modules can implement the same library. * - * @see common_test_library() + * @see common_test_library_info() */ function testLibraryNameConflicts() { $farbtastic = drupal_get_library('common_test', 'farbtastic'); @@ -1455,10 +1455,10 @@ class JavaScriptTestCase extends DrupalWebTestCase { // Retrieve all libraries registered by a module. $libraries = drupal_get_library('common_test'); $this->assertTrue(isset($libraries['farbtastic']), t('Retrieved all module libraries.')); - // Retrieve all libraries for a module not implementing hook_library(). + // Retrieve all libraries for a module not implementing hook_library_info(). // Note: This test installs Locale module. $libraries = drupal_get_library('locale'); - $this->assertEqual($libraries, array(), t('Retrieving libraries from a module not implementing hook_library() returns an emtpy array.')); + $this->assertEqual($libraries, array(), t('Retrieving libraries from a module not implementing hook_library_info() returns an emtpy array.')); // Retrieve a specific library by module and name. $farbtastic = drupal_get_library('common_test', 'farbtastic'); diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module index c400eaed114..b8355a9bcc9 100644 --- a/modules/simpletest/tests/common_test.module +++ b/modules/simpletest/tests/common_test.module @@ -184,9 +184,9 @@ function theme_common_test_foo($variables) { } /** - * Implements hook_library_alter(). + * Implements hook_library_info_alter(). */ -function common_test_library_alter(&$libraries, $module) { +function common_test_library_info_alter(&$libraries, $module) { if ($module == 'system' && isset($libraries['farbtastic'])) { // Change the title of Farbtastic to "Farbtastic: Altered Library". $libraries['farbtastic']['title'] = 'Farbtastic: Altered Library'; @@ -196,11 +196,11 @@ function common_test_library_alter(&$libraries, $module) { } /** - * Implements hook_library(). + * Implements hook_library_info(). * * Adds Farbtastic in a different version. */ -function common_test_library() { +function common_test_library_info() { $libraries['farbtastic'] = array( 'title' => 'Custom Farbtastic Library', 'website' => 'http://code.google.com/p/farbtastic/', diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 297d4d9f7f6..71f8d3fa17c 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -326,11 +326,11 @@ function hook_js_alter(&$javascript) { * @return * An array defining libraries associated with a module. * - * @see system_library() + * @see system_library_info() * @see drupal_add_library() * @see drupal_get_library() */ -function hook_library() { +function hook_library_info() { // Library One. $libraries['library-1'] = array( 'title' => 'Library One', @@ -384,9 +384,9 @@ function hook_library() { * @param $module * The name of the module that registered the libraries. * - * @see hook_library() + * @see hook_library_info() */ -function hook_library_alter(&$libraries, $module) { +function hook_library_info_alter(&$libraries, $module) { // Update Farbtastic to version 2.0. if ($module == 'system' && isset($libraries['farbtastic'])) { // Verify existing version is older than the one we are updating to. diff --git a/modules/system/system.module b/modules/system/system.module index d7dc69cc4c5..549cd1d180b 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1075,9 +1075,9 @@ function _system_batch_theme() { } /** - * Implements hook_library(). + * Implements hook_library_info(). */ -function system_library() { +function system_library_info() { // Drupal's Ajax framework. $libraries['drupal.ajax'] = array( 'title' => 'Drupal AJAX', |