summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-05-14 08:23:15 +0000
committerDries Buytaert <dries@buytaert.net>2009-05-14 08:23:15 +0000
commit1778c5cca962127d3bfd81ff407391f6d00da2a9 (patch)
tree02b38ca7253c62f2c82fe5969cc791e1180fe143
parent3ac59eee96a6b6553f07946f6f95373ece050e2b (diff)
downloadbrdo-1778c5cca962127d3bfd81ff407391f6d00da2a9.tar.gz
brdo-1778c5cca962127d3bfd81ff407391f6d00da2a9.tar.bz2
- Patch #310467 by chx, moshe weitzman: made hook_theme slimmer.
-rw-r--r--includes/common.inc3
-rw-r--r--includes/theme.inc30
-rw-r--r--modules/aggregator/aggregator.module8
-rw-r--r--modules/block/block.module1
-rw-r--r--modules/filter/filter.module3
-rw-r--r--modules/menu/menu.module2
-rw-r--r--modules/node/node.module6
-rw-r--r--modules/profile/profile.module1
-rw-r--r--modules/search/search.module2
-rw-r--r--modules/simpletest/simpletest.module2
-rw-r--r--modules/system/system.api.php4
-rw-r--r--modules/system/system.module10
-rw-r--r--modules/trigger/trigger.module1
-rw-r--r--modules/user/user.module8
14 files changed, 6 insertions, 75 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 45c15cc8b..21d0de0d3 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3555,8 +3555,7 @@ function drupal_common_theme() {
'maintenance_page' => array(
'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE),
'template' => 'maintenance-page',
- 'path' => 'includes',
- 'file' => 'theme.maintenance.inc',
+ 'path' => 'includes'
),
'update_page' => array(
'arguments' => array('content' => NULL, 'show_messages' => TRUE),
diff --git a/includes/theme.inc b/includes/theme.inc
index ccfcbb5e0..66f82caaf 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -280,7 +280,7 @@ function drupal_theme_rebuild() {
function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
$result = array();
$function = $name . '_theme';
- if (function_exists($function)) {
+ if (drupal_function_exists($function)) {
$result = $function($cache, $type, $theme, $path);
foreach ($result as $hook => $info) {
@@ -291,18 +291,6 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
if (!isset($info['template']) && !isset($info['function'])) {
$result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name . '_') . $hook;
}
- // If a path is set in the info, use what was set. Otherwise use the
- // default path. This is mostly so system.module can declare theme
- // functions on behalf of core .include files.
- // All files are included to be safe. Conditionally included
- // files can prevent them from getting registered.
- if (isset($info['file']) && !isset($info['path'])) {
- $result[$hook]['file'] = $path . '/' . $info['file'];
- include_once DRUPAL_ROOT . '/' . $result[$hook]['file'];
- }
- elseif (isset($info['file']) && isset($info['path'])) {
- include_once DRUPAL_ROOT . '/' . $info['path'] . '/' . $info['file'];
- }
if (isset($info['template']) && !isset($info['path'])) {
$result[$hook]['template'] = $path . '/' . $info['template'];
@@ -345,10 +333,10 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
}
foreach ($prefixes as $prefix) {
- if (function_exists($prefix . '_preprocess')) {
+ if (drupal_function_exists($prefix . '_preprocess')) {
$info['preprocess functions'][] = $prefix . '_preprocess';
}
- if (function_exists($prefix . '_preprocess_' . $hook)) {
+ if (drupal_function_exists($prefix . '_preprocess_' . $hook)) {
$info['preprocess functions'][] = $prefix . '_preprocess_' . $hook;
}
}
@@ -377,10 +365,10 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
if (!isset($info['preprocess functions'])) {
$cache[$hook]['preprocess functions'] = array();
}
- if (function_exists($name . '_preprocess')) {
+ if (drupal_function_exists($name . '_preprocess')) {
$cache[$hook]['preprocess functions'][] = $name . '_preprocess';
}
- if (function_exists($name . '_preprocess_' . $hook)) {
+ if (drupal_function_exists($name . '_preprocess_' . $hook)) {
$cache[$hook]['preprocess functions'][] = $name . '_preprocess_' . $hook;
}
// Ensure uniqueness.
@@ -614,14 +602,6 @@ function theme() {
// point path_to_theme() to the currently used theme path:
$theme_path = $info['theme path'];
- // Include a file if the theme function or preprocess function is held elsewhere.
- if (!empty($info['file'])) {
- $include_file = $info['file'];
- if (isset($info['path'])) {
- $include_file = $info['path'] . '/' . $include_file;
- }
- include_once DRUPAL_ROOT . '/' . $include_file;
- }
if (isset($info['function'])) {
// The theme call is a function.
if (drupal_function_exists($info['function'])) {
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 6f7174e10..efd9ea2c9 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -36,16 +36,13 @@ function aggregator_theme() {
return array(
'aggregator_wrapper' => array(
'arguments' => array('content' => NULL),
- 'file' => 'aggregator.pages.inc',
'template' => 'aggregator-wrapper',
),
'aggregator_categorize_items' => array(
'arguments' => array('form' => NULL),
- 'file' => 'aggregator.pages.inc',
),
'aggregator_feed_source' => array(
'arguments' => array('feed' => NULL),
- 'file' => 'aggregator.pages.inc',
'template' => 'aggregator-feed-source',
),
'aggregator_block_item' => array(
@@ -53,26 +50,21 @@ function aggregator_theme() {
),
'aggregator_summary_items' => array(
'arguments' => array('summary_items' => NULL, 'source' => NULL),
- 'file' => 'aggregator.pages.inc',
'template' => 'aggregator-summary-items',
),
'aggregator_summary_item' => array(
'arguments' => array('item' => NULL),
- 'file' => 'aggregator.pages.inc',
'template' => 'aggregator-summary-item',
),
'aggregator_item' => array(
'arguments' => array('item' => NULL),
- 'file' => 'aggregator.pages.inc',
'template' => 'aggregator-item',
),
'aggregator_page_opml' => array(
'arguments' => array('feeds' => NULL),
- 'file' => 'aggregator.pages.inc',
),
'aggregator_page_rss' => array(
'arguments' => array('feeds' => NULL, 'category' => NULL),
- 'file' => 'aggregator.pages.inc',
),
);
}
diff --git a/modules/block/block.module b/modules/block/block.module
index 9a46ba7d4..6646b824c 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -98,7 +98,6 @@ function block_theme() {
),
'block_admin_display_form' => array(
'template' => 'block-admin-display-form',
- 'file' => 'block.admin.inc',
'arguments' => array('form' => NULL),
),
);
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index af04e6227..9c28418ca 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -47,15 +47,12 @@ function filter_theme() {
return array(
'filter_admin_overview' => array(
'arguments' => array('form' => NULL),
- 'file' => 'filter.admin.inc',
),
'filter_admin_order' => array(
'arguments' => array('form' => NULL),
- 'file' => 'filter.admin.inc',
),
'filter_tips' => array(
'arguments' => array('tips' => NULL, 'long' => FALSE),
- 'file' => 'filter.pages.inc',
),
'filter_tips_more_info' => array(
'arguments' => array(),
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 9ef1f757e..fc0faa22d 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -141,11 +141,9 @@ function menu_menu() {
function menu_theme() {
return array(
'menu_overview_form' => array(
- 'file' => 'menu.admin.inc',
'arguments' => array('form' => NULL),
),
'menu_admin_overview' => array(
- 'file' => 'menu.admin.inc',
'arguments' => array('title' => NULL, 'name' => NULL, 'description' => NULL),
),
);
diff --git a/modules/node/node.module b/modules/node/node.module
index 58f8d2856..55939b2c8 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -107,27 +107,21 @@ function node_theme() {
),
'node_filter_form' => array(
'arguments' => array('form' => NULL),
- 'file' => 'node.admin.inc',
),
'node_filters' => array(
'arguments' => array('form' => NULL),
- 'file' => 'node.admin.inc',
),
'node_admin_nodes' => array(
'arguments' => array('form' => NULL),
- 'file' => 'node.admin.inc',
),
'node_add_list' => array(
'arguments' => array('content' => NULL),
- 'file' => 'node.pages.inc',
),
'node_form' => array(
'arguments' => array('form' => NULL),
- 'file' => 'node.pages.inc',
),
'node_preview' => array(
'arguments' => array('node' => NULL),
- 'file' => 'node.pages.inc',
),
'node_log_message' => array(
'arguments' => array('log' => NULL),
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index e4d3ab08f..919910746 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -67,7 +67,6 @@ function profile_theme() {
),
'profile_admin_overview' => array(
'arguments' => array('form' => NULL),
- 'file' => 'profile.admin.inc',
)
);
}
diff --git a/modules/search/search.module b/modules/search/search.module
index 6ce7bd21b..8973c6cc9 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -126,12 +126,10 @@ function search_theme() {
),
'search_result' => array(
'arguments' => array('result' => NULL, 'type' => NULL),
- 'file' => 'search.pages.inc',
'template' => 'search-result',
),
'search_results' => array(
'arguments' => array('results' => NULL, 'type' => NULL),
- 'file' => 'search.pages.inc',
'template' => 'search-results',
),
'search_results_listing' => array(
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module
index dbaf44807..6b5e4ea48 100644
--- a/modules/simpletest/simpletest.module
+++ b/modules/simpletest/simpletest.module
@@ -70,11 +70,9 @@ function simpletest_theme() {
return array(
'simpletest_test_table' => array(
'arguments' => array('table' => NULL),
- 'file' => 'simpletest.pages.inc',
),
'simpletest_result_summary' => array(
'arguments' => array('form' => NULL),
- 'file' => 'simpletest.pages.inc',
),
);
}
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 823bbfdc9..e14c45368 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -580,10 +580,6 @@ function hook_perm() {
* 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.
- * - 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
- * to split theme functions out into separate files quite easily.
* - path: Override the path of the file to be used. Ordinarily the module or
* theme path will be used, but if the file will not be in the default path,
* include it here. This path should be relative to the Drupal root
diff --git a/modules/system/system.module b/modules/system/system.module
index 57f0b787e..e4bb758ed 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -121,43 +121,33 @@ function system_theme() {
return array_merge(drupal_common_theme(), array(
'system_theme_select_form' => array(
'arguments' => array('form' => NULL),
- 'file' => 'system.admin.inc',
),
'system_themes_form' => array(
'arguments' => array('form' => NULL),
- 'file' => 'system.admin.inc',
),
'system_modules_fieldset' => array(
'arguments' => array('form' => NULL),
- 'file' => 'system.admin.inc',
),
'system_modules_incompatible' => array(
'arguments' => array('message' => NULL),
- 'file' => 'system.admin.inc',
),
'system_modules_uninstall' => array(
'arguments' => array('form' => NULL),
- 'file' => 'system.admin.inc',
),
'status_report' => array(
'arguments' => array('requirements' => NULL),
- 'file' => 'system.admin.inc',
),
'admin_page' => array(
'arguments' => array('blocks' => NULL),
- 'file' => 'system.admin.inc',
),
'admin_block' => array(
'arguments' => array('block' => NULL),
- 'file' => 'system.admin.inc',
),
'admin_block_content' => array(
'arguments' => array('content' => NULL),
- 'file' => 'system.admin.inc',
),
'system_admin_by_module' => array(
'arguments' => array('menu_items' => NULL),
- 'file' => 'system.admin.inc',
),
'system_powered_by' => array(
'arguments' => array('image_path' => NULL),
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index f7c931ca3..612b0da19 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -149,7 +149,6 @@ function trigger_theme() {
return array(
'trigger_display' => array(
'arguments' => array('element'),
- 'file' => 'trigger.admin.inc',
),
);
}
diff --git a/modules/user/user.module b/modules/user/user.module
index d15bfcdee..96d6618fe 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -42,40 +42,32 @@ function user_theme() {
'user_profile' => array(
'arguments' => array('elements' => NULL),
'template' => 'user-profile',
- 'file' => 'user.pages.inc',
),
'user_profile_category' => array(
'arguments' => array('element' => NULL),
'template' => 'user-profile-category',
- 'file' => 'user.pages.inc',
),
'user_profile_item' => array(
'arguments' => array('element' => NULL),
'template' => 'user-profile-item',
- 'file' => 'user.pages.inc',
),
'user_list' => array(
'arguments' => array('users' => NULL, 'title' => NULL),
),
'user_admin_perm' => array(
'arguments' => array('form' => NULL),
- 'file' => 'user.admin.inc',
),
'user_admin_new_role' => array(
'arguments' => array('form' => NULL),
- 'file' => 'user.admin.inc',
),
'user_admin_account' => array(
'arguments' => array('form' => NULL),
- 'file' => 'user.admin.inc',
),
'user_filter_form' => array(
'arguments' => array('form' => NULL),
- 'file' => 'user.admin.inc',
),
'user_filters' => array(
'arguments' => array('form' => NULL),
- 'file' => 'user.admin.inc',
),
'user_signature' => array(
'arguments' => array('signature' => NULL),