function common_test_drupal_alter_alter
Same name in other branches
- 9 core/modules/system/tests/modules/common_test/common_test.module \common_test_drupal_alter_alter()
- 8.9.x core/modules/system/tests/modules/common_test/common_test.module \common_test_drupal_alter_alter()
- 10 core/modules/system/tests/modules/common_test/common_test.module \common_test_drupal_alter_alter()
- 11.x core/modules/system/tests/modules/common_test/common_test.module \common_test_drupal_alter_alter()
Implements hook_TYPE_alter().
File
-
modules/
simpletest/ tests/ common_test.module, line 132
Code
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';
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.