diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f98df80..63515ed 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -615,6 +615,9 @@ function _theme($hook, $variables = array()) { if (isset($info['path'])) { $template_file = $info['path'] . '/' . $template_file; } + if (!file_exists($template_file)) { + return; + } // Add the theme suggestions to the variables array just before rendering // the template for backwards compatibility with template engines. $variables['theme_hook_suggestions'] = $suggestions; @@ -2746,31 +2749,24 @@ function drupal_common_theme() { // From theme.inc. 'html' => array( 'variables' => array('page_object' => NULL), - 'template' => 'html', ), 'page' => array( 'render element' => 'page', - 'template' => 'page', ), 'region' => array( 'render element' => 'elements', - 'template' => 'region', ), 'datetime' => array( 'variables' => array('timestamp' => NULL, 'text' => NULL, 'attributes' => array(), 'html' => FALSE), - 'template' => 'datetime', ), 'status_messages' => array( 'variables' => array('display' => NULL), - 'template' => 'status-messages', ), 'links' => array( 'variables' => array('links' => array(), 'attributes' => array('class' => array('links')), 'heading' => array(), 'set_active_class' => FALSE), - 'template' => 'links', ), 'dropbutton_wrapper' => array( 'variables' => array('children' => NULL), - 'template' => 'dropbutton-wrapper', ), 'image' => array( // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft @@ -2786,51 +2782,47 @@ function drupal_common_theme() { // The title attribute is optional in all cases, so it is omitted by // default. 'variables' => array('uri' => NULL, 'width' => NULL, 'height' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array()), - 'template' => 'image', ), 'breadcrumb' => array( 'variables' => array('breadcrumb' => NULL), - 'template' => 'breadcrumb', ), 'table' => array( 'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => FALSE, 'responsive' => TRUE, 'empty' => ''), ), 'tablesort_indicator' => array( 'variables' => array('style' => NULL), - 'template' => 'tablesort-indicator', ), 'mark' => array( 'variables' => array('status' => MARK_NEW), + 'function' => 'theme_mark', ), 'item_list' => array( 'variables' => array('items' => array(), 'title' => '', 'list_type' => 'ul', 'attributes' => array(), 'empty' => NULL), - 'template' => 'item-list', ), 'feed_icon' => array( 'variables' => array('url' => NULL, 'title' => NULL), - 'template' => 'feed-icon', ), 'more_link' => array( - 'variables' => array('url' => NULL, 'title' => NULL) + 'variables' => array('url' => NULL, 'title' => NULL), + 'function' => 'theme_more_link', ), 'progress_bar' => array( 'variables' => array('label' => NULL, 'percent' => NULL, 'message' => NULL), - 'template' => 'progress-bar', ), 'indentation' => array( 'variables' => array('size' => 1), + 'function' => 'theme_indentation', ), // From theme.maintenance.inc. 'maintenance_page' => array( 'variables' => array('content' => NULL, 'show_messages' => TRUE, 'page' => array()), - 'template' => 'maintenance-page', ), 'install_page' => array( 'variables' => array('content' => NULL, 'show_messages' => TRUE, 'page' => array()), - 'template' => 'install-page', ), 'task_list' => array( 'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL), + 'function' => 'theme_task_list', ), 'authorize_message' => array( 'variables' => array('message' => NULL, 'success' => TRUE), @@ -2841,87 +2833,86 @@ function drupal_common_theme() { // From pager.inc. 'pager' => array( 'variables' => array('tags' => array(), 'element' => 0, 'parameters' => array(), 'quantity' => 9), - 'template' => 'pager', ), // From menu.inc. 'menu_link' => array( 'render element' => 'element', + 'function' => 'theme_menu_link', ), 'menu_tree' => array( 'render element' => 'tree', + 'function' => 'theme_menu_tree', ), 'menu_local_task' => array( 'render element' => 'element', + 'function' => 'theme_menu_local_task', ), 'menu_local_action' => array( 'render element' => 'element', + 'function' => 'theme_menu_local_action', ), 'menu_local_tasks' => array( 'variables' => array('primary' => array(), 'secondary' => array()), + 'function' => 'theme_menu_local_tasks', ), // From form.inc. 'input' => array( 'render element' => 'element', + 'function' => 'theme_input', ), 'select' => array( 'render element' => 'element', - 'template' => 'select', ), 'fieldset' => array( 'render element' => 'element', - 'template' => 'fieldset', ), 'details' => array( 'render element' => 'element', - 'template' => 'details', ), 'radios' => array( 'render element' => 'element', - 'template' => 'radios', ), 'date' => array( 'render element' => 'element', + 'function' => 'theme_date', ), 'checkboxes' => array( 'render element' => 'element', + 'function' => 'theme_checkboxes', ), 'form' => array( 'render element' => 'element', - 'template' => 'form', ), 'textarea' => array( 'render element' => 'element', - 'template' => 'textarea', ), 'tableselect' => array( 'render element' => 'element', + 'function' => 'theme_tableselect', ), 'form_element' => array( 'render element' => 'element', - 'template' => 'form-element', ), 'form_required_marker' => array( 'render element' => 'element', + 'function' => 'theme_form_required_marker', ), 'form_element_label' => array( 'render element' => 'element', + 'function' => 'theme_form_element_label', ), 'vertical_tabs' => array( 'render element' => 'element', - 'template' => 'vertical-tabs', ), 'container' => array( 'render element' => 'element', - 'template' => 'container', ), // From field system. 'field' => array( 'render element' => 'element', - 'template' => 'field', ), 'field_multiple_value_form' => array( 'render element' => 'element', - 'template' => 'field-multiple-value-form', ), ); } diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index e84b33b..ee5f8ec 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -426,7 +426,8 @@ protected function processExtension(&$cache, $name, $type, $theme, $path) { // If function and file are omitted, default to standard naming // conventions. if (!isset($info['template']) && !isset($info['function'])) { - $result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name . '_') . $hook; + $info['template'] = strtr($hook, '_', '-'); + $result[$hook]['template'] = strtr($hook, '_', '-'); } if (isset($cache[$hook]['includes'])) { diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 29773f1..767bf56 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -52,6 +52,7 @@ function toolbar_theme($existing, $type, $theme, $path) { ); $items['toolbar_item'] = array( 'render element' => 'element', + 'function' => 'theme_toolbar_item', ); return $items;