summaryrefslogtreecommitdiff
path: root/modules/simpletest/simpletest.module
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2008-11-23 16:00:08 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2008-11-23 16:00:08 +0000
commit1b4dd805ca9ebcf34815f480533a1069ba63b7e3 (patch)
treeb38a60a5fd251f5583b449c5ce180cb42024d3a7 /modules/simpletest/simpletest.module
parent25f63a896578c8e342acfe7eebcd4e21cf982349 (diff)
downloadbrdo-1b4dd805ca9ebcf34815f480533a1069ba63b7e3.tar.gz
brdo-1b4dd805ca9ebcf34815f480533a1069ba63b7e3.tar.bz2
#315801 by Rob Loach, Grugnoh2, mfer and dmitrig01: Add a hook_js_alter() to modify JavaScript being printed to the page.
Diffstat (limited to 'modules/simpletest/simpletest.module')
-rw-r--r--modules/simpletest/simpletest.module17
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module
index 71225ff5c..9d1431065 100644
--- a/modules/simpletest/simpletest.module
+++ b/modules/simpletest/simpletest.module
@@ -210,10 +210,7 @@ function simpletest_test_form() {
function theme_simpletest_test_table($table) {
drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css');
-
- // Since SimpleTest is a special use case for the table select, stick the
- // SimpleTest JavaScript above the table select.
- drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js', array('weight' => JS_DEFAULT - 1));
+ drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js');
// Create header for test selection table.
$header = array(
@@ -301,6 +298,18 @@ function theme_simpletest_test_table($table) {
}
}
+/**
+ * Implementation of hook_js_alter().
+ */
+function simpletest_js_alter(&$javascript) {
+ // Since SimpleTest is a special use case for the table select, stick the
+ // SimpleTest JavaScript above the table select.
+ $simpletest = drupal_get_path('module', 'simpletest') . '/simpletest.js';
+ if (array_key_exists($simpletest, $javascript) && array_key_exists('misc/tableselect.js', $javascript)) {
+ $javascript[$simpletest]['weight'] = $javascript['misc/tableselect.js']['weight'] - 1;
+ }
+}
+
function theme_simpletest_result_summary($form, $text = NULL) {
return '<div class="simpletest-'. ($form['#ok'] ? 'pass' : 'fail') .'">' . _simpletest_format_summary_line($form) . '</div>';
}