summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2007-08-26 07:46:11 (GMT)
committerDries Buytaert2007-08-26 07:46:11 (GMT)
commit5e73b66f3a00d42567b8d6b35ee821788428dc75 (patch)
treeced854b3a64a3110e6531b4845ba781b252c9ca5
parenta8800e4f2694a0107bbf425212bdccb1fe81f5cb (diff)
- Patch #168028 by dvessler, merlinofchaos, pwolanin et al: both theme functions and templates may need include files. Flush your caches.
-rw-r--r--INSTALL.mysql.txt2
-rw-r--r--includes/common.inc6
-rw-r--r--includes/theme.inc34
-rw-r--r--modules/block/block.module2
-rw-r--r--modules/comment/comment.module6
-rw-r--r--modules/forum/forum.module12
-rw-r--r--modules/node/node.module8
-rw-r--r--modules/poll/poll.module6
-rw-r--r--modules/profile/profile.module6
-rw-r--r--modules/user/user.module8
10 files changed, 47 insertions, 43 deletions
diff --git a/INSTALL.mysql.txt b/INSTALL.mysql.txt
index 78b08a3..781e7b2 100644
--- a/INSTALL.mysql.txt
+++ b/INSTALL.mysql.txt
@@ -38,4 +38,4 @@ not be able to run Drupal.
If successful, MySQL will reply with:
Query OK, 0 rows affected
-
+
diff --git a/includes/common.inc b/includes/common.inc
index 366c2b9..1a2d79c 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2624,7 +2624,7 @@ function drupal_common_themes() {
),
'page' => array(
'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE),
- 'file' => 'page',
+ 'template' => 'page',
),
'maintenance_page' => array(
'arguments' => array('content' => NULL, 'show_messages' => TRUE),
@@ -2664,11 +2664,11 @@ function drupal_common_themes() {
),
'box' => array(
'arguments' => array('title' => NULL, 'content' => NULL, 'region' => 'main'),
- 'file' => 'box',
+ 'template' => 'box',
),
'block' => array(
'arguments' => array('block' => NULL),
- 'file' => 'block',
+ 'template' => 'block',
),
'mark' => array(
'arguments' => array('type' => MARK_NEW),
diff --git a/includes/theme.inc b/includes/theme.inc
index 7151834..d1e4f6e 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -231,14 +231,24 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
$result[$hook]['theme path'] = $path;
// if function and file are left out, default to standard naming
// conventions.
- if (!isset($info['file']) && !isset($info['function'])) {
+ 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($result[$hook]['file']);
+ }
+ elseif (isset($info['file']) && isset($info['path'])) {
+ include_once($info['path'] .'/'. $info['file']);
+ }
+
+ if (isset($info['template']) && !isset($info['path'])) {
+ $result[$hook]['template'] = $path .'/'. $info['template'];
}
// If 'arguments' have been defined previously, carry them forward.
// This should happen if a theme overrides a Drupal defined theme
@@ -492,16 +502,16 @@ function theme() {
// point path_to_theme() to the currently used theme path:
$theme_path = $hooks[$hook]['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($include_file);
+ }
if (isset($info['function'])) {
// The theme call is a function.
- // Include a file if this theme function is held elsewhere.
- if (!empty($info['file'])) {
- $function_file = $info['file'];
- if (isset($info['path'])) {
- $function_file = $info['path'] .'/'. $function_file;
- }
- include_once($function_file);
- }
$output = call_user_func_array($info['function'], $args);
}
else {
@@ -566,7 +576,7 @@ function theme() {
}
if (empty($template_file)) {
- $template_file = $hooks[$hook]['file'] . $extension;
+ $template_file = $hooks[$hook]['template'] . $extension;
if (isset($hooks[$hook]['path'])) {
$template_file = $hooks[$hook]['path'] .'/'. $template_file;
}
@@ -678,7 +688,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$hook = strtr($template, '-', '_');
if (isset($cache[$hook])) {
$templates[$hook] = array(
- 'file' => $template,
+ 'template' => $template,
'path' => dirname($file->filename),
);
}
@@ -698,7 +708,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$file = substr($match, 0, strpos($match, '.'));
// Put the underscores back in for the hook name and register this pattern.
$templates[strtr($file, '-', '_')] = array(
- 'file' => $file,
+ 'template' => $file,
'path' => dirname($files[$match]->filename),
'arguments' => $info['arguments'],
);
diff --git a/modules/block/block.module b/modules/block/block.module
index ec87d3c..cbaa3ef 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -103,7 +103,7 @@ function block_help($path, $arg) {
function block_theme() {
return array(
'block_admin_display' => array(
- 'file' => 'block-admin-display',
+ 'template' => 'block-admin-display',
'arguments' => array('form' => NULL),
),
);
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 967e253..03f19f3 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -160,11 +160,11 @@ function comment_theme() {
'arguments' => array('form' => NULL),
),
'comment' => array(
- 'file' => 'comment.tpl.php',
+ 'template' => 'comment',
'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()),
),
'comment_folded' => array(
- 'file' => 'comment-folded',
+ 'template' => 'comment-folded',
'arguments' => array('comment' => NULL),
),
'comment_flat_collapsed' => array(
@@ -183,7 +183,7 @@ function comment_theme() {
'arguments' => array('nid' => NULL),
),
'comment_wrapper' => array(
- 'file' => 'comment-wrapper',
+ 'template' => 'comment-wrapper',
'arguments' => array('content' => NULL, 'node' => NULL),
),
'comment_submitted' => array(
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index c529682..9701ec2 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -34,27 +34,27 @@ function forum_help($path, $arg) {
function forum_theme() {
return array(
'forums' => array(
- 'file' => 'forums',
+ 'template' => 'forums',
'arguments' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
),
'forum_list' => array(
- 'file' => 'forum-list',
+ 'template' => 'forum-list',
'arguments' => array('forums' => NULL, 'parents' => NULL, 'tid' => NULL),
),
'forum_topic_list' => array(
- 'file' => 'forum-topic-list',
+ 'template' => 'forum-topic-list',
'arguments' => array('tid' => NULL, 'topics' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
),
'forum_icon' => array(
- 'file' => 'forum-icon',
+ 'template' => 'forum-icon',
'arguments' => array('new_posts' => NULL, 'num_posts' => 0, 'comment_mode' => 0, 'sticky' => 0),
),
'forum_topic_navigation' => array(
- 'file' => 'forum-topic-navigation',
+ 'template' => 'forum-topic-navigation',
'arguments' => array('node' => NULL),
),
'forum_submitted' => array(
- 'file' => 'forum-submitted',
+ 'template' => 'forum-submitted',
'arguments' => array('topic' => NULL),
),
);
diff --git a/modules/node/node.module b/modules/node/node.module
index 9f21f1b..3463582 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -63,7 +63,7 @@ function node_theme() {
return array(
'node' => array(
'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
- 'file' => 'node',
+ 'template' => 'node',
),
'node_list' => array(
'arguments' => array('items' => NULL, 'title' => NULL),
@@ -74,32 +74,26 @@ function node_theme() {
'node_filter_form' => array(
'arguments' => array('form' => NULL),
'file' => 'node.admin.inc',
- 'function' => 'theme_node_filter_form',
),
'node_filters' => array(
'arguments' => array('form' => NULL),
'file' => 'node.admin.inc',
- 'function' => 'theme_node_filters',
),
'node_admin_nodes' => array(
'arguments' => array('form' => NULL),
'file' => 'node.admin.inc',
- 'function' => 'theme_node_admin_nodes',
),
'node_add_list' => array(
'arguments' => array('content' => NULL),
'file' => 'node.pages.inc',
- 'function' => 'theme_node_add_list',
),
'node_form' => array(
'arguments' => array('form' => NULL),
'file' => 'node.pages.inc',
- 'function' => 'theme_node_form',
),
'node_preview' => array(
'arguments' => array('node' => NULL),
'file' => 'node.pages.inc',
- 'function' => 'theme_node_preview',
),
'node_log_message' => array(
'arguments' => array('log' => NULL),
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 14936a2..64f83f0 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -33,15 +33,15 @@ function poll_init() {
function poll_theme() {
return array(
'poll_vote' => array(
- 'file' => 'poll-vote',
+ 'template' => 'poll-vote',
'arguments' => array('form' => NULL),
),
'poll_results' => array(
- 'file' => 'poll-results',
+ 'template' => 'poll-results',
'arguments' => array('raw_title' => NULL, 'results' => NULL, 'votes' => NULL, 'raw_links' => NULL, 'block' => NULL, 'nid' => NULL, 'vote' => NULL),
),
'poll_bar' => array(
- 'file' => 'poll-bar',
+ 'template' => 'poll-bar',
'arguments' => array('title' => NULL, 'votes' => NULL, 'total_votes' => NULL, 'vote' => NULL, 'block' => NULL),
),
);
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 78d59ee..4a253d7 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -58,15 +58,15 @@ function profile_theme() {
return array(
'profile_block' => array(
'arguments' => array('account' => NULL, 'fields' => array()),
- 'file' => 'profile-block',
+ 'template' => 'profile-block',
),
'profile_listing' => array(
'arguments' => array('account' => NULL, 'fields' => array()),
- 'file' => 'profile-listing',
+ 'template' => 'profile-listing',
),
'profile_wrapper' => array(
'arguments' => array('content' => NULL),
- 'file' => 'profile-wrapper',
+ 'template' => 'profile-wrapper',
)
);
}
diff --git a/modules/user/user.module b/modules/user/user.module
index 9f26867..56200b8 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -31,19 +31,19 @@ function user_theme() {
return array(
'user_picture' => array(
'arguments' => array('account' => NULL),
- 'file' => 'user-picture',
+ 'template' => 'user-picture',
),
'user_profile' => array(
'arguments' => array('account' => NULL),
- 'file' => 'user-profile',
+ 'template' => 'user-profile',
),
'user_profile_category' => array(
'arguments' => array('element' => NULL),
- 'file' => 'user-profile-category',
+ 'template' => 'user-profile-category',
),
'user_profile_item' => array(
'arguments' => array('element' => NULL),
- 'file' => 'user-profile-item',
+ 'template' => 'user-profile-item',
),
'user_list' => array(
'arguments' => array('users' => NULL, 'title' => NULL),