summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/common_test.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-13 16:38:43 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-13 16:38:43 +0000
commitfbfa7a4150a40d6df9347692bb6681f45f804c7d (patch)
tree425db0f6cc7b72b8a9350c5a462fe718e0ed2877 /modules/simpletest/tests/common_test.module
parentf67e438b4196a6bc79c0da576da0a9e09fedb612 (diff)
downloadbrdo-fbfa7a4150a40d6df9347692bb6681f45f804c7d.tar.gz
brdo-fbfa7a4150a40d6df9347692bb6681f45f804c7d.tar.bz2
- Patch #593522 by sun: a better and faster drupal_alter().
Diffstat (limited to 'modules/simpletest/tests/common_test.module')
-rw-r--r--modules/simpletest/tests/common_test.module32
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module
index f7abf51b6..74866f098 100644
--- a/modules/simpletest/tests/common_test.module
+++ b/modules/simpletest/tests/common_test.module
@@ -10,7 +10,6 @@
* Implement hook_menu().
*/
function common_test_menu() {
- $items = array();
$items['common-test/drupal_goto'] = array(
'title' => 'Drupal Goto',
'page callback' => 'common_test_drupal_goto_land',
@@ -71,6 +70,37 @@ function common_test_drupal_goto_alter(&$args) {
}
/**
+ * Implement hook_TYPE_alter().
+ */
+function common_test_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
+ // Alter first argument.
+ if (is_array($data)) {
+ $data['foo'] = 'Drupal';
+ }
+ elseif (is_object($data)) {
+ $data->foo = 'Drupal';
+ }
+ // Alter second argument, if present.
+ if (isset($arg2)) {
+ if (is_array($arg2)) {
+ $arg2['foo'] = 'Drupal';
+ }
+ elseif (is_object($arg2)) {
+ $arg2->foo = 'Drupal';
+ }
+ }
+ // Try to alter third argument, if present.
+ if (isset($arg3)) {
+ if (is_array($arg3)) {
+ $arg3['foo'] = 'Drupal';
+ }
+ elseif (is_object($arg3)) {
+ $arg3->foo = 'Drupal';
+ }
+ }
+}
+
+/**
* Implement hook_theme().
*/
function common_test_theme() {