diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-10-26 18:06:39 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-10-26 18:06:39 +0000 |
commit | df2cf40d2cd197ed5f1960b026b31aad32b5d930 (patch) | |
tree | c34e2f3b6f44f11002859353864f32ce613fa71c /modules | |
parent | 617fe51e625e1bf43d31c8c3f08325d67af2d9d4 (diff) | |
download | brdo-df2cf40d2cd197ed5f1960b026b31aad32b5d930.tar.gz brdo-df2cf40d2cd197ed5f1960b026b31aad32b5d930.tar.bz2 |
- Patch #266358 by Rob Loach, mfer: use array in drupal_add_css().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/block/block.admin.inc | 2 | ||||
-rw-r--r-- | modules/color/color.module | 4 | ||||
-rw-r--r-- | modules/dblog/dblog.module | 2 | ||||
-rw-r--r-- | modules/help/help.admin.inc | 2 | ||||
-rw-r--r-- | modules/openid/openid.module | 2 | ||||
-rw-r--r-- | modules/openid/openid.pages.inc | 2 | ||||
-rw-r--r-- | modules/search/search.module | 2 | ||||
-rw-r--r-- | modules/simpletest/simpletest.module | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 50 | ||||
-rw-r--r-- | modules/system/system.module | 8 | ||||
-rw-r--r-- | modules/tracker/tracker.pages.inc | 2 | ||||
-rw-r--r-- | modules/user/user.module | 2 |
12 files changed, 65 insertions, 15 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index a8f515d03..9e16f8af6 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -28,7 +28,7 @@ function block_admin_display($theme = NULL) { function block_admin_display_form(&$form_state, $blocks, $theme = NULL) { global $theme_key, $custom_theme; - drupal_add_css(drupal_get_path('module', 'block') . '/block.css', 'module', 'all', FALSE); + drupal_add_css(drupal_get_path('module', 'block') . '/block.css', array('preprocess' => FALSE)); // If non-default theme configuration has been selected, set the custom theme. $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland'); diff --git a/modules/color/color.module b/modules/color/color.module index e99f907fc..51c894e51 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -153,11 +153,11 @@ function color_scheme_form(&$form_state, $theme) { $info = color_get_info($theme); // Add Farbtastic color picker. - drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE); + drupal_add_css('misc/farbtastic/farbtastic.css', array('preprocess' => FALSE)); drupal_add_js('misc/farbtastic/farbtastic.js'); // Add custom CSS and JS. - drupal_add_css($base . '/color.css', 'module', 'all', FALSE); + 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) diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module index 7fbee34bc..5f3623e53 100644 --- a/modules/dblog/dblog.module +++ b/modules/dblog/dblog.module @@ -83,7 +83,7 @@ function dblog_menu() { function dblog_init() { if (arg(0) == 'admin' && arg(1) == 'reports') { // Add the CSS for this module - drupal_add_css(drupal_get_path('module', 'dblog') . '/dblog.css', 'module', 'all', FALSE); + drupal_add_css(drupal_get_path('module', 'dblog') . '/dblog.css', array('preprocess' => FALSE)); } } diff --git a/modules/help/help.admin.inc b/modules/help/help.admin.inc index 701f8fabc..5b038c729 100644 --- a/modules/help/help.admin.inc +++ b/modules/help/help.admin.inc @@ -11,7 +11,7 @@ */ function help_main() { // Add CSS - drupal_add_css(drupal_get_path('module', 'help') . '/help.css', 'module', 'all', FALSE); + drupal_add_css(drupal_get_path('module', 'help') . '/help.css', array('preprocess' => FALSE)); $output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . help_links_as_list(); return $output; } diff --git a/modules/openid/openid.module b/modules/openid/openid.module index 3af31b0d6..d02c60b23 100644 --- a/modules/openid/openid.module +++ b/modules/openid/openid.module @@ -75,7 +75,7 @@ function openid_user_insert(&$edit, &$account, $category = NULL) { */ function openid_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'user_login_block' || $form_id == 'user_login') { - drupal_add_css(drupal_get_path('module', 'openid') . '/openid.css', 'module'); + drupal_add_css(drupal_get_path('module', 'openid') . '/openid.css'); drupal_add_js(drupal_get_path('module', 'openid') . '/openid.js'); if (!empty($form_state['post']['openid_identifier'])) { $form['name']['#required'] = FALSE; diff --git a/modules/openid/openid.pages.inc b/modules/openid/openid.pages.inc index efd7684ee..28c8f947b 100644 --- a/modules/openid/openid.pages.inc +++ b/modules/openid/openid.pages.inc @@ -29,7 +29,7 @@ function openid_authentication_page() { */ function openid_user_identities($account) { drupal_set_title($account->name); - drupal_add_css(drupal_get_path('module', 'openid') . '/openid.css', 'module'); + drupal_add_css(drupal_get_path('module', 'openid') . '/openid.css'); // Check to see if we got a response $result = openid_complete(); diff --git a/modules/search/search.module b/modules/search/search.module index 6846f8f65..c96dfbfa7 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -1031,7 +1031,7 @@ function search_get_keys() { function search_form(&$form_state, $action = '', $keys = '', $type = NULL, $prompt = NULL) { // Add CSS - drupal_add_css(drupal_get_path('module', 'search') . '/search.css', 'module', 'all', FALSE); + drupal_add_css(drupal_get_path('module', 'search') . '/search.css', array('preprocess' => FALSE)); if (!$action) { $action = url('search/' . $type); diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 372ad1f3f..c1752b84f 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -199,7 +199,7 @@ function simpletest_test_form() { } function theme_simpletest_test_table($table) { - drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css', 'module'); + drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css'); drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js', 'module'); // Create header for test selection table. diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 74e053cf9..6a82018db 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -115,6 +115,56 @@ class DrupalTagsHandlingTestCase extends DrupalWebTestCase { } /** + * Test the Drupal CSS system. + */ +class CascadingStylesheetsTestCase extends DrupalWebTestCase { + /** + * Implementation of getInfo(). + */ + function getInfo() { + return array( + 'name' => t('Cascading stylesheets'), + 'description' => t('Tests adding various cascading stylesheets to the page.'), + 'group' => t('System') + ); + } + + /** + * Implementation of setUp(). + */ + function setUp() { + parent::setUp(); + // Reset drupal_add_css() before each test. + drupal_add_css(NULL, NULL, TRUE); + } + + /** + * Check default stylesheets as empty. + */ + function testDefault() { + $this->assertEqual(array(), drupal_add_css(), t('Default CSS is empty.')); + } + + /** + * Tests adding a file stylesheet. + */ + function testAddFile() { + $path = drupal_get_path('module', 'simpletest') . '/simpletest.css'; + $css = drupal_add_css($path); + $this->assertEqual($css['all']['module'][$path], TRUE, t('Adding a CSS file caches it properly.')); + } + + /** + * Tests rendering the stylesheets. + */ + function testRenderFile() { + $css = drupal_get_path('module', 'simpletest') . '/simpletest.css'; + drupal_add_css($css); + $this->assertTrue(strpos(drupal_get_css(), $css) > 0, t('Rendered CSS includes the added stylesheet.')); + } +} + +/** * Test drupal_http_request(). */ class DrupalHTTPRequestTestCase extends DrupalWebTestCase { diff --git a/modules/system/system.module b/modules/system/system.module index 633623a4b..ed9dda45b 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -706,13 +706,13 @@ function system_init() { if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) { global $custom_theme; $custom_theme = variable_get('admin_theme', '0'); - drupal_add_css(drupal_get_path('module', 'system') . '/admin.css', 'module'); + drupal_add_css(drupal_get_path('module', 'system') . '/admin.css'); } // Add the CSS for this module. - drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css', 'module'); - drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module'); - drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css', 'module'); + drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css'); + drupal_add_css(drupal_get_path('module', 'system') . '/system.css'); + drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css'); } /** diff --git a/modules/tracker/tracker.pages.inc b/modules/tracker/tracker.pages.inc index 027b39419..5a7fd3f3c 100644 --- a/modules/tracker/tracker.pages.inc +++ b/modules/tracker/tracker.pages.inc @@ -12,7 +12,7 @@ */ function tracker_page($account = NULL, $set_title = FALSE) { // Add CSS - drupal_add_css(drupal_get_path('module', 'tracker') . '/tracker.css', 'module', 'all', FALSE); + drupal_add_css(drupal_get_path('module', 'tracker') . '/tracker.css', array('preprocess' => FALSE)); if ($account) { if ($set_title) { diff --git a/modules/user/user.module b/modules/user/user.module index a8c9de8be..351a7fe90 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1120,7 +1120,7 @@ function user_menu() { } function user_init() { - drupal_add_css(drupal_get_path('module', 'user') . '/user.css', 'module'); + drupal_add_css(drupal_get_path('module', 'user') . '/user.css'); } function user_uid_optional_load($arg) { |