summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.api.php37
-rw-r--r--modules/system/system.module45
2 files changed, 52 insertions, 30 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index a1695071a..b379649a6 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -849,12 +849,19 @@ function hook_permission() {
* to each sub-array is the internal name of the hook, and the array contains
* info about the hook. Each array may contain the following items:
*
- * - arguments: (required) An array of arguments that this theme hook uses. This
- * value allows the theme layer to properly utilize templates. The
- * array keys represent the name of the variable, and the value will be
- * used as the default value if not specified to the theme() function.
- * These arguments must be in the same order that they will be given to
- * the theme() function.
+ * - variables: (required if "render element" not present) An array of
+ * variables that this theme hook uses. This value allows the theme layer to
+ * properly utilize templates. Each array key represents the name of the
+ * variable and the value will be used as the default value if it is not given
+ * when theme() is called. Template implementations receive these arguments as
+ * variables in the template file. Function implementations are passed this
+ * array data in the $variables parameter.
+ * - render element: (required if "variables" not present) A string that is the
+ * name of the sole renderable element to pass to the theme function. The
+ * string represents the name of the "variable" that will hold the renderable
+ * array inside any optional preprocess or process functions. Cannot be used
+ * with the "variables" item; only one or the other, not both, can be present
+ * in a hook's info array.
* - file: The file the implementation resides in. This file will be included
* prior to the theme being rendered, to make sure that the function or
* preprocess function (as needed) is actually loaded; this makes it possible
@@ -929,16 +936,24 @@ function hook_permission() {
function hook_theme($existing, $type, $theme, $path) {
return array(
'forum_display' => array(
- 'arguments' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
+ 'variables' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
),
'forum_list' => array(
- 'arguments' => array('forums' => NULL, 'parents' => NULL, 'tid' => NULL),
+ 'variables' => array('forums' => NULL, 'parents' => NULL, 'tid' => NULL),
),
'forum_topic_list' => array(
- 'arguments' => array('tid' => NULL, 'topics' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
+ 'variables' => array('tid' => NULL, 'topics' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
),
'forum_icon' => array(
- 'arguments' => array('new_posts' => NULL, 'num_posts' => 0, 'comment_mode' => 0, 'sticky' => 0),
+ 'variables' => array('new_posts' => NULL, 'num_posts' => 0, 'comment_mode' => 0, 'sticky' => 0),
+ ),
+ 'status_report' => array(
+ 'render element' => 'requirements',
+ 'file' => 'system.admin.inc',
+ ),
+ 'system_date_time_settings' => array(
+ 'render element' => 'form',
+ 'file' => 'system.admin.inc',
),
);
}
@@ -960,7 +975,7 @@ function hook_theme($existing, $type, $theme, $path) {
* For example:
* @code
* $theme_registry['user_profile'] = array(
- * 'arguments' => array(
+ * 'variables' => array(
* 'account' => NULL,
* ),
* 'template' => 'modules/user/user-profile',
diff --git a/modules/system/system.module b/modules/system/system.module
index f67500a3d..bc582e6ff 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -156,63 +156,65 @@ function system_help($path, $arg) {
function system_theme() {
return array_merge(drupal_common_theme(), array(
'system_themes_form' => array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
'file' => 'system.admin.inc',
),
'system_settings_form' => array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
'file' => 'system.admin.inc',
),
'confirm_form' => array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
),
'system_modules_fieldset' => array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
'file' => 'system.admin.inc',
),
'system_modules_incompatible' => array(
- 'arguments' => array('message' => NULL),
+ 'variables' => array('message' => NULL),
'file' => 'system.admin.inc',
),
'system_modules_uninstall' => array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
'file' => 'system.admin.inc',
),
'status_report' => array(
- 'arguments' => array('requirements' => NULL),
+ 'render element' => 'requirements',
'file' => 'system.admin.inc',
),
'admin_page' => array(
- 'arguments' => array('blocks' => NULL),
+ 'variables' => array('blocks' => NULL),
'file' => 'system.admin.inc',
),
'admin_block' => array(
- 'arguments' => array('block' => NULL),
+ 'variables' => array('block' => NULL),
'file' => 'system.admin.inc',
),
'admin_block_content' => array(
- 'arguments' => array('content' => NULL),
+ 'variables' => array('content' => NULL),
'file' => 'system.admin.inc',
),
'system_admin_by_module' => array(
- 'arguments' => array('menu_items' => NULL),
+ 'variables' => array('menu_items' => NULL),
'file' => 'system.admin.inc',
),
'system_powered_by' => array(
- 'arguments' => NULL,
+ 'variables' => array(),
),
'meta_generator_html' => array(
- 'arguments' => array('version' => NULL),
+ 'variables' => array('version' => NULL),
),
'meta_generator_header' => array(
- 'arguments' => array('version' => NULL),
+ 'variables' => array('version' => NULL),
+ ),
+ 'system_compact_link' => array(
+ 'variables' => array(),
),
- 'system_compact_link' => array(),
'system_run_cron_image' => array(
- 'arguments' => array('image_path' => NULL),
+ 'variables' => array('image_path' => NULL),
),
'system_date_time_settings' => array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
'file' => 'system.admin.inc',
),
));
@@ -3464,8 +3466,13 @@ function system_preprocess(&$variables, $hook) {
$variables['contextual_links'] = array();
// Determine the primary theme function argument.
- $keys = array_keys($hooks[$hook]['arguments']);
- $key = $keys[0];
+ if (isset($hooks[$hook]['variables'])) {
+ $keys = array_keys($hooks[$hook]['variables']);
+ $key = $keys[0];
+ }
+ else {
+ $key = $hooks[$hook]['render element'];
+ }
if (isset($variables[$key])) {
$element = $variables[$key];
}