summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-18 05:28:43 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-18 05:28:43 +0000
commit1650fea5d949b576bcc779d6315250da0ba7ec82 (patch)
treed2bbbd716e9f11754dd881145ae06c2a372f4757 /modules/simpletest
parent2484439643f86cbc2da3b4f391eb3e23e51fc94d (diff)
downloadbrdo-1650fea5d949b576bcc779d6315250da0ba7ec82.tar.gz
brdo-1650fea5d949b576bcc779d6315250da0ba7ec82.tar.bz2
#516150 by David_Rothstein, dropcube, Senpai, alexanderpas, sun: Add fallback for main content block rendering. (Make it so you can't render your site completely unusable by disabling block module. Oopsie.)
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/tests/system_test.module49
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module
index 6926dfe5f..be4d443f5 100644
--- a/modules/simpletest/tests/system_test.module
+++ b/modules/simpletest/tests/system_test.module
@@ -73,6 +73,27 @@ function system_test_menu() {
'type' => MENU_CALLBACK,
);
+ $items['system-test/main-content-handling'] = array(
+ 'title' => 'Test main content handling',
+ 'page callback' => 'system_test_main_content_fallback',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
+ $items['system-test/main-content-fallback'] = array(
+ 'title' => 'Test main content fallback',
+ 'page callback' => 'system_test_main_content_fallback',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
+ $items['system-test/main-content-duplication'] = array(
+ 'title' => 'Test main content duplication',
+ 'page callback' => 'system_test_main_content_fallback',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
return $items;
}
@@ -226,3 +247,31 @@ function system_test_lock_exit() {
return 'FALSE: Lock not acquired in system_test_lock_exit()';
}
}
+
+/**
+ * Implement hook_page_build().
+ */
+function system_test_page_build(&$page) {
+ $menu_item = menu_get_item();
+ $main_content_display = &drupal_static('system_main_content_added', FALSE);
+
+ if ($menu_item['path'] == 'system-test/main-content-handling') {
+ $page['footer'] = drupal_set_page_content();
+ $page['footer']['main']['#markup'] = '<div id="system-test-content">' . $page['footer']['main']['#markup'] . '</div>';
+ }
+ else if ($menu_item['path'] == 'system-test/main-content-fallback') {
+ drupal_set_page_content();
+ $main_content_display = FALSE;
+ }
+ else if ($menu_item['path'] == 'system-test/main-content-duplication') {
+ drupal_set_page_content();
+ }
+}
+
+/**
+ * Menu callback to test main content fallback().
+ */
+function system_test_main_content_fallback() {
+ return t('Content to test main content fallback');
+}
+