Commit 5e73b66f authored by Dries's avatar Dries

- Patch #168028 by dvessler, merlinofchaos, pwolanin et al: both theme...

- Patch #168028 by dvessler, merlinofchaos, pwolanin et al: both theme functions and templates may need include files. Flush your caches.
parent a8800e4f
...@@ -38,4 +38,4 @@ not be able to run Drupal. ...@@ -38,4 +38,4 @@ not be able to run Drupal.
If successful, MySQL will reply with: If successful, MySQL will reply with:
Query OK, 0 rows affected Query OK, 0 rows affected
...@@ -2624,7 +2624,7 @@ function drupal_common_themes() { ...@@ -2624,7 +2624,7 @@ function drupal_common_themes() {
), ),
'page' => array( 'page' => array(
'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE), 'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE),
'file' => 'page', 'template' => 'page',
), ),
'maintenance_page' => array( 'maintenance_page' => array(
'arguments' => array('content' => NULL, 'show_messages' => TRUE), 'arguments' => array('content' => NULL, 'show_messages' => TRUE),
...@@ -2664,11 +2664,11 @@ function drupal_common_themes() { ...@@ -2664,11 +2664,11 @@ function drupal_common_themes() {
), ),
'box' => array( 'box' => array(
'arguments' => array('title' => NULL, 'content' => NULL, 'region' => 'main'), 'arguments' => array('title' => NULL, 'content' => NULL, 'region' => 'main'),
'file' => 'box', 'template' => 'box',
), ),
'block' => array( 'block' => array(
'arguments' => array('block' => NULL), 'arguments' => array('block' => NULL),
'file' => 'block', 'template' => 'block',
), ),
'mark' => array( 'mark' => array(
'arguments' => array('type' => MARK_NEW), 'arguments' => array('type' => MARK_NEW),
......
...@@ -231,14 +231,24 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { ...@@ -231,14 +231,24 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
$result[$hook]['theme path'] = $path; $result[$hook]['theme path'] = $path;
// if function and file are left out, default to standard naming // if function and file are left out, default to standard naming
// conventions. // conventions.
if (!isset($info['file']) && !isset($info['function'])) { if (!isset($info['template']) && !isset($info['function'])) {
$result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name .'_') . $hook; $result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name .'_') . $hook;
} }
// If a path is set in the info, use what was set. Otherwise use the // 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 // default path. This is mostly so system.module can declare theme
// functions on behalf of core .include files. // 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'])) { if (isset($info['file']) && !isset($info['path'])) {
$result[$hook]['file'] = $path .'/'. $info['file']; $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. // If 'arguments' have been defined previously, carry them forward.
// This should happen if a theme overrides a Drupal defined theme // This should happen if a theme overrides a Drupal defined theme
...@@ -492,16 +502,16 @@ function theme() { ...@@ -492,16 +502,16 @@ function theme() {
// point path_to_theme() to the currently used theme path: // point path_to_theme() to the currently used theme path:
$theme_path = $hooks[$hook]['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'])) { if (isset($info['function'])) {
// The theme call is a 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); $output = call_user_func_array($info['function'], $args);
} }
else { else {
...@@ -566,7 +576,7 @@ function theme() { ...@@ -566,7 +576,7 @@ function theme() {
} }
if (empty($template_file)) { if (empty($template_file)) {
$template_file = $hooks[$hook]['file'] . $extension; $template_file = $hooks[$hook]['template'] . $extension;
if (isset($hooks[$hook]['path'])) { if (isset($hooks[$hook]['path'])) {
$template_file = $hooks[$hook]['path'] .'/'. $template_file; $template_file = $hooks[$hook]['path'] .'/'. $template_file;
} }
...@@ -678,7 +688,7 @@ function drupal_find_theme_templates($cache, $extension, $path) { ...@@ -678,7 +688,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$hook = strtr($template, '-', '_'); $hook = strtr($template, '-', '_');
if (isset($cache[$hook])) { if (isset($cache[$hook])) {
$templates[$hook] = array( $templates[$hook] = array(
'file' => $template, 'template' => $template,
'path' => dirname($file->filename), 'path' => dirname($file->filename),
); );
} }
...@@ -698,7 +708,7 @@ function drupal_find_theme_templates($cache, $extension, $path) { ...@@ -698,7 +708,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$file = substr($match, 0, strpos($match, '.')); $file = substr($match, 0, strpos($match, '.'));
// Put the underscores back in for the hook name and register this pattern. // Put the underscores back in for the hook name and register this pattern.
$templates[strtr($file, '-', '_')] = array( $templates[strtr($file, '-', '_')] = array(
'file' => $file, 'template' => $file,
'path' => dirname($files[$match]->filename), 'path' => dirname($files[$match]->filename),
'arguments' => $info['arguments'], 'arguments' => $info['arguments'],
); );
......
...@@ -103,7 +103,7 @@ function block_help($path, $arg) { ...@@ -103,7 +103,7 @@ function block_help($path, $arg) {
function block_theme() { function block_theme() {
return array( return array(
'block_admin_display' => array( 'block_admin_display' => array(
'file' => 'block-admin-display', 'template' => 'block-admin-display',
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
), ),
); );
......
...@@ -160,11 +160,11 @@ function comment_theme() { ...@@ -160,11 +160,11 @@ function comment_theme() {
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
), ),
'comment' => array( 'comment' => array(
'file' => 'comment.tpl.php', 'template' => 'comment',
'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()), 'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()),
), ),
'comment_folded' => array( 'comment_folded' => array(
'file' => 'comment-folded', 'template' => 'comment-folded',
'arguments' => array('comment' => NULL), 'arguments' => array('comment' => NULL),
), ),
'comment_flat_collapsed' => array( 'comment_flat_collapsed' => array(
...@@ -183,7 +183,7 @@ function comment_theme() { ...@@ -183,7 +183,7 @@ function comment_theme() {
'arguments' => array('nid' => NULL), 'arguments' => array('nid' => NULL),
), ),
'comment_wrapper' => array( 'comment_wrapper' => array(
'file' => 'comment-wrapper', 'template' => 'comment-wrapper',
'arguments' => array('content' => NULL, 'node' => NULL), 'arguments' => array('content' => NULL, 'node' => NULL),
), ),
'comment_submitted' => array( 'comment_submitted' => array(
......
...@@ -34,27 +34,27 @@ function forum_help($path, $arg) { ...@@ -34,27 +34,27 @@ function forum_help($path, $arg) {
function forum_theme() { function forum_theme() {
return array( return array(
'forums' => array( 'forums' => array(
'file' => 'forums', 'template' => 'forums',
'arguments' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL), 'arguments' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
), ),
'forum_list' => array( 'forum_list' => array(
'file' => 'forum-list', 'template' => 'forum-list',
'arguments' => array('forums' => NULL, 'parents' => NULL, 'tid' => NULL), 'arguments' => array('forums' => NULL, 'parents' => NULL, 'tid' => NULL),
), ),
'forum_topic_list' => array( 'forum_topic_list' => array(
'file' => 'forum-topic-list', 'template' => 'forum-topic-list',
'arguments' => array('tid' => NULL, 'topics' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL), 'arguments' => array('tid' => NULL, 'topics' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
), ),
'forum_icon' => array( 'forum_icon' => array(
'file' => 'forum-icon', 'template' => 'forum-icon',
'arguments' => array('new_posts' => NULL, 'num_posts' => 0, 'comment_mode' => 0, 'sticky' => 0), 'arguments' => array('new_posts' => NULL, 'num_posts' => 0, 'comment_mode' => 0, 'sticky' => 0),
), ),
'forum_topic_navigation' => array( 'forum_topic_navigation' => array(
'file' => 'forum-topic-navigation', 'template' => 'forum-topic-navigation',
'arguments' => array('node' => NULL), 'arguments' => array('node' => NULL),
), ),
'forum_submitted' => array( 'forum_submitted' => array(
'file' => 'forum-submitted', 'template' => 'forum-submitted',
'arguments' => array('topic' => NULL), 'arguments' => array('topic' => NULL),
), ),
); );
......
...@@ -63,7 +63,7 @@ function node_theme() { ...@@ -63,7 +63,7 @@ function node_theme() {
return array( return array(
'node' => array( 'node' => array(
'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE), 'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
'file' => 'node', 'template' => 'node',
), ),
'node_list' => array( 'node_list' => array(
'arguments' => array('items' => NULL, 'title' => NULL), 'arguments' => array('items' => NULL, 'title' => NULL),
...@@ -74,32 +74,26 @@ function node_theme() { ...@@ -74,32 +74,26 @@ function node_theme() {
'node_filter_form' => array( 'node_filter_form' => array(
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
'file' => 'node.admin.inc', 'file' => 'node.admin.inc',
'function' => 'theme_node_filter_form',
), ),
'node_filters' => array( 'node_filters' => array(
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
'file' => 'node.admin.inc', 'file' => 'node.admin.inc',
'function' => 'theme_node_filters',
), ),
'node_admin_nodes' => array( 'node_admin_nodes' => array(
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
'file' => 'node.admin.inc', 'file' => 'node.admin.inc',
'function' => 'theme_node_admin_nodes',
), ),
'node_add_list' => array( 'node_add_list' => array(
'arguments' => array('content' => NULL), 'arguments' => array('content' => NULL),
'file' => 'node.pages.inc', 'file' => 'node.pages.inc',
'function' => 'theme_node_add_list',
), ),
'node_form' => array( 'node_form' => array(
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
'file' => 'node.pages.inc', 'file' => 'node.pages.inc',
'function' => 'theme_node_form',
), ),
'node_preview' => array( 'node_preview' => array(
'arguments' => array('node' => NULL), 'arguments' => array('node' => NULL),
'file' => 'node.pages.inc', 'file' => 'node.pages.inc',
'function' => 'theme_node_preview',
), ),
'node_log_message' => array( 'node_log_message' => array(
'arguments' => array('log' => NULL), 'arguments' => array('log' => NULL),
......
...@@ -33,15 +33,15 @@ function poll_init() { ...@@ -33,15 +33,15 @@ function poll_init() {
function poll_theme() { function poll_theme() {
return array( return array(
'poll_vote' => array( 'poll_vote' => array(
'file' => 'poll-vote', 'template' => 'poll-vote',
'arguments' => array('form' => NULL), 'arguments' => array('form' => NULL),
), ),
'poll_results' => array( '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), 'arguments' => array('raw_title' => NULL, 'results' => NULL, 'votes' => NULL, 'raw_links' => NULL, 'block' => NULL, 'nid' => NULL, 'vote' => NULL),
), ),
'poll_bar' => array( 'poll_bar' => array(
'file' => 'poll-bar', 'template' => 'poll-bar',
'arguments' => array('title' => NULL, 'votes' => NULL, 'total_votes' => NULL, 'vote' => NULL, 'block' => NULL), 'arguments' => array('title' => NULL, 'votes' => NULL, 'total_votes' => NULL, 'vote' => NULL, 'block' => NULL),
), ),
); );
......
...@@ -58,15 +58,15 @@ function profile_theme() { ...@@ -58,15 +58,15 @@ function profile_theme() {
return array( return array(
'profile_block' => array( 'profile_block' => array(
'arguments' => array('account' => NULL, 'fields' => array()), 'arguments' => array('account' => NULL, 'fields' => array()),
'file' => 'profile-block', 'template' => 'profile-block',
), ),
'profile_listing' => array( 'profile_listing' => array(
'arguments' => array('account' => NULL, 'fields' => array()), 'arguments' => array('account' => NULL, 'fields' => array()),
'file' => 'profile-listing', 'template' => 'profile-listing',
), ),
'profile_wrapper' => array( 'profile_wrapper' => array(
'arguments' => array('content' => NULL), 'arguments' => array('content' => NULL),
'file' => 'profile-wrapper', 'template' => 'profile-wrapper',
) )
); );
} }
......
...@@ -31,19 +31,19 @@ function user_theme() { ...@@ -31,19 +31,19 @@ function user_theme() {
return array( return array(
'user_picture' => array( 'user_picture' => array(
'arguments' => array('account' => NULL), 'arguments' => array('account' => NULL),
'file' => 'user-picture', 'template' => 'user-picture',
), ),
'user_profile' => array( 'user_profile' => array(
'arguments' => array('account' => NULL), 'arguments' => array('account' => NULL),
'file' => 'user-profile', 'template' => 'user-profile',
), ),
'user_profile_category' => array( 'user_profile_category' => array(
'arguments' => array('element' => NULL), 'arguments' => array('element' => NULL),
'file' => 'user-profile-category', 'template' => 'user-profile-category',
), ),
'user_profile_item' => array( 'user_profile_item' => array(
'arguments' => array('element' => NULL), 'arguments' => array('element' => NULL),
'file' => 'user-profile-item', 'template' => 'user-profile-item',
), ),
'user_list' => array( 'user_list' => array(
'arguments' => array('users' => NULL, 'title' => NULL), 'arguments' => array('users' => NULL, 'title' => NULL),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment