summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.admin.inc5
-rw-r--r--modules/system/system.api.php57
-rw-r--r--modules/system/system.module13
3 files changed, 74 insertions, 1 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 703de2d01..be461d727 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1888,7 +1888,10 @@ function system_batch_page() {
elseif (isset($output)) {
// Force a page without blocks or messages to
// display a list of collected messages later.
- print theme('page', $output, FALSE, FALSE);
+ $page = drupal_get_page($output);
+ $page['#show_blocks'] = FALSE;
+ $page['#show_messages'] = FALSE;
+ return $page;
}
}
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 3c74f48db..cd98c5081 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -180,6 +180,63 @@ function hook_js_alter(&$javascript) {
}
/**
+ * Perform alterations before a page is rendered.
+ *
+ * Use this hook when you want to add, remove, or alter elements at the page
+ * level. If you are making changes to entities such as forms, menus, or user
+ * profiles, use those objects' native alter hooks instead (hook_form_alter(),
+ * for example).
+ *
+ * The $page array contains top level elements for each block region:
+ * @code
+ * $page['header']
+ * $page['left']
+ * $page['content']
+ * $page['right']
+ * $page['footer']
+ * @endcode
+ *
+ * The 'content' element contains the main content of the current page, and its
+ * structure will vary depending on what module is responsible for building the
+ * page. Some legacy modules may not return structured content at all: their
+ * pre-rendered markup will be located in $page['content']['main']['#markup'].
+ *
+ * Pages built by Drupal's core Node and Blog modules use a standard structure:
+ *
+ * @code
+ * // Node body.
+ * $page['content']['nodes'][$nid]['body']
+ * // Array of links attached to the node (add comments, read more).
+ * $page['content']['nodes'][$nid]['links']
+ * // The node object itself.
+ * $page['content']['nodes'][$nid]['#node']
+ * // The results pager.
+ * $page['content']['pager']
+ * @code
+ *
+ * Blocks may be referenced by their module/delta pair within a region:
+ * @code
+ * // The login block in the left sidebar region.
+ * $page['left']['user-login']['#block'];
+ * @endcode
+ *
+ * @param $page
+ * Nested array of renderable elements that make up the page.
+ *
+ * @see drupal_render_page()
+ */
+function hook_page_alter($page) {
+ if (menu_get_object('node', 1)) {
+ // We are on a node detail page. Append a standard disclaimer to the
+ // content region.
+ $page['content']['disclaimer'] = array(
+ '#markup' => t('Acme, Inc. is not responsible for the contents of this sample code.'),
+ '#weight' => 25,
+ );
+ }
+}
+
+/**
* Perform alterations before a form is rendered.
*
* One popular use of this hook is to add form elements to the node form. When
diff --git a/modules/system/system.module b/modules/system/system.module
index f50318254..581ae0aab 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -237,6 +237,19 @@ function system_elements() {
'#action' => request_uri(),
);
+ $type['page'] = array(
+ '#show_messages' => TRUE,
+ '#show_blocks' => TRUE,
+ '#theme' => 'page',
+ );
+
+ $type['list'] = array(
+ '#title' => '',
+ '#list_type' => 'ul',
+ '#attributes' => array(),
+ '#items' => array(),
+ );
+
/**
* Input elements.
*/