diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/color/color.module | 28 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 14 | ||||
-rw-r--r-- | modules/system/system.module | 13 |
3 files changed, 45 insertions, 10 deletions
diff --git a/modules/color/color.module b/modules/color/color.module index d3ddeadc1..2cefe7d43 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -154,16 +154,6 @@ function color_scheme_form(&$form_state, $theme) { $base = drupal_get_path('module', 'color'); $info = color_get_info($theme); - // Add Farbtastic color picker. - drupal_add_library('system', 'farbtastic'); - - // Add custom CSS and JS. - drupal_add_css($base . '/color.css', array('preprocess' => FALSE)); - drupal_add_js($base . '/color.js'); - drupal_add_js(array('color' => array( - 'reference' => color_get_palette($theme, TRUE) - )), 'setting'); - // See if we're using a predefined scheme. $current = implode(',', variable_get('color_' . $theme . '_palette', array())); // Note: we use the original theme when the default scheme is chosen. @@ -176,6 +166,24 @@ function color_scheme_form(&$form_state, $theme) { '#title' => t('Color set'), '#options' => $info['schemes'], '#default_value' => $current, + // Add Farbtastic color picker. + '#attached_library' => array( + array('system', 'farbtastic'), + ), + // Add custom CSS. + '#attached_css' => array( + $base . '/color.css' => array('preprocess' => FALSE), + ), + // Add custom JavaScript. + '#attached_js' => array( + $base . '/color.js', + array( + 'data' => array('color' => array( + 'reference' => color_get_palette($theme, TRUE), + )), + 'type' => 'setting', + ), + ), ); // Add palette fields. diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 13aad21e0..ad565b1ab 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -857,6 +857,20 @@ class JavaScriptTestCase extends DrupalWebTestCase { $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'unknown') === FALSE, t('Unknown library was not added to the page.')); } + + /** + * Tests the addition of libraries through the #attached_library property. + */ + function testAttachedLibrary() { + $element = array( + '#attached_library' => array( + array('system', 'farbtastic'), + ) + ); + drupal_render($element); + $scripts = drupal_get_js(); + $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('The attached_library property adds the additional libraries.')); + } } /** diff --git a/modules/system/system.module b/modules/system/system.module index 274558e0d..a4c0a600d 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -931,6 +931,19 @@ function system_library() { ), ); + // Vertical Tabs. + $libraries['vertical-tabs'] = array( + 'title' => 'Vertical Tabs', + 'website' => 'http://drupal.org/node/323112', + 'version' => '1.0', + 'js' => array( + 'misc/vertical-tabs.js' => array(), + ), + 'css' => array( + 'misc/vertical-tabs.css' => array(), + ), + ); + // Farbtastic. $libraries['farbtastic'] = array( 'title' => 'Farbtastic', |