From 9e24cd11c8ed82a2ba0219b2a894fc379cf630d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Rene=CC=81e=20Beach?= Date: Wed, 15 Jan 2014 16:00:21 -0500 Subject: [PATCH] Issue #2173655 by jessebeach: Refactor theme() to _theme(); make it a private API to discourage module developers from circumventing the renderable build system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit a95ee21df3b823d696647658ba3946f6b4bedba2 Author: J. Renée Beach Date: Wed Jan 15 15:42:58 2014 -0500 theme() in documentation. Signed-off-by: J. Renée Beach commit 4b19b7deb5cd649810439d6e140fbbd01b601d20 Author: J. Renée Beach Date: Wed Jan 15 15:35:37 2014 -0500 theme() that was passed an array Signed-off-by: J. Renée Beach commit 21f4e8d525dd43844ba993122aa14c736bf53a6b Author: J. Renée Beach Date: Wed Jan 15 15:30:50 2014 -0500 Replace theme() with _theme() Signed-off-by: J. Renée Beach Signed-off-by: J. Renée Beach --- core/authorize.php | 6 ++-- core/includes/ajax.inc | 4 +-- core/includes/batch.inc | 2 +- core/includes/common.inc | 24 ++++++------- core/includes/errors.inc | 2 +- core/includes/form.inc | 8 ++--- core/includes/install.core.inc | 6 ++-- core/includes/pager.inc | 14 ++++---- core/includes/tablesort.inc | 4 +-- core/includes/theme.inc | 42 +++++++++++----------- core/includes/theme.maintenance.inc | 4 +-- .../Drupal/Core/Extension/UpdateModuleHandler.php | 2 +- core/lib/Drupal/Core/Theme/Registry.php | 14 ++++---- core/lib/Drupal/Core/Utility/ThemeRegistry.php | 2 +- core/modules/block/block.api.php | 2 +- .../Drupal/block/Tests/BlockHiddenRegionTest.php | 2 +- core/modules/comment/comment.module | 4 +-- core/modules/image/image.module | 6 ++-- core/modules/locale/locale.bulk.inc | 2 +- core/modules/node/node.api.php | 2 +- .../Plugin/Search/SearchExtraTypeSearch.php | 2 +- .../lib/Drupal/simpletest/DrupalUnitTestBase.php | 4 +-- .../simpletest/Tests/DrupalUnitTestBaseTest.php | 4 +-- .../lib/Drupal/simpletest/WebTestBase.php | 2 +- core/modules/system/entity.api.php | 2 +- .../lib/Drupal/system/Tests/Theme/TableTest.php | 8 ++--- .../lib/Drupal/system/Tests/Theme/ThemeTest.php | 12 +++---- .../system/Tests/Theme/TwigDebugMarkupTest.php | 8 ++--- core/modules/system/system.api.php | 20 +++++------ .../EventSubscriber/ThemeTestSubscriber.php | 2 +- .../lib/Drupal/theme_test/ThemeTestController.php | 6 ++-- .../tests/modules/theme_test/theme_test.module | 6 ++-- .../twig_theme_test/TwigThemeTestController.php | 2 +- core/modules/system/theme.api.php | 14 ++++---- core/modules/taxonomy/taxonomy.api.php | 2 +- core/modules/update/update.manager.inc | 4 +-- core/modules/user/user.api.php | 2 +- .../views/Plugin/views/field/FieldPluginBase.php | 4 +-- .../Drupal/views/Plugin/views/row/RssFields.php | 2 +- .../lib/Drupal/views/Plugin/views/style/Rss.php | 2 +- core/themes/engines/twig/twig.engine | 4 +-- 41 files changed, 132 insertions(+), 132 deletions(-) diff --git a/core/authorize.php b/core/authorize.php index ecb7e22..c2bcbd4 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -125,7 +125,7 @@ function authorize_access_allowed() { drupal_set_message($results['page_message']['message'], $results['page_message']['type']); } - $output = theme('authorize_report', array('messages' => $results['messages'])); + $output = _theme('authorize_report', array('messages' => $results['messages'])); $links = array(); if (is_array($results['tasks'])) { @@ -138,7 +138,7 @@ function authorize_access_allowed() { )); } - $output .= theme('item_list', array('items' => $links, 'title' => t('Next steps'))); + $output .= _theme('item_list', array('items' => $links, 'title' => t('Next steps'))); } // If a batch is running, let it run. elseif ($request->query->has('batch')) { @@ -163,5 +163,5 @@ function authorize_access_allowed() { if (!empty($output)) { drupal_add_http_header('Content-Type', 'text/html; charset=utf-8'); - print theme('maintenance_page', array('content' => $output, 'show_messages' => $show_messages)); + print _theme('maintenance_page', array('content' => $output, 'show_messages' => $show_messages)); } diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index de6f5d0..d5dd0a8 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -216,7 +216,7 @@ * @code * $commands = array(); * $commands[] = ajax_command_replace(NULL, $output); - * $commands[] = ajax_command_prepend(NULL, theme('status_messages')); + * $commands[] = ajax_command_prepend(NULL, _theme('status_messages')); * return array('#type' => 'ajax', '#commands' => $commands); * @endcode * @@ -362,7 +362,7 @@ function ajax_prepare_response($page_callback_result) { $commands[] = ajax_command_insert(NULL, $html); // Add the status messages inside the new content's wrapper element, so that // on subsequent Ajax requests, it is treated as old content. - $commands[] = ajax_command_prepend(NULL, theme('status_messages')); + $commands[] = ajax_command_prepend(NULL, _theme('status_messages')); } return $commands; diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 597ab43..9d326df 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -125,7 +125,7 @@ function _batch_progress_page() { // the error message. ob_start(); $fallback = $current_set['error_message'] . '
' . $batch['error_message']; - $fallback = theme('maintenance_page', array('content' => $fallback, 'show_messages' => FALSE)); + $fallback = _theme('maintenance_page', array('content' => $fallback, 'show_messages' => FALSE)); // We strip the end of the page using a marker in the template, so any // additional HTML output by PHP shows up inside the page rather than below diff --git a/core/includes/common.inc b/core/includes/common.inc index 84e5edb..8ec47d2 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -375,7 +375,7 @@ function drupal_add_feed($url = NULL, $title = '') { $stored_feed_links = &drupal_static(__FUNCTION__, array()); if (isset($url)) { - $stored_feed_links[$url] = theme('feed_icon', array('url' => $url, 'title' => $title)); + $stored_feed_links[$url] = _theme('feed_icon', array('url' => $url, 'title' => $title)); $build['#attached']['drupal_add_html_head_link'][][] = array( 'rel' => 'alternate', @@ -1373,7 +1373,7 @@ function base_path() { * Adds a LINK tag with a distinct 'rel' attribute to the page's HEAD. * * This function can be called as long the HTML header hasn't been sent, which - * on normal pages is up through the preprocess step of theme('html'). Adding + * on normal pages is up through the preprocess step of _theme('html'). Adding * a link will overwrite a prior link with the exact same 'rel' and 'href' * attributes. * @@ -2811,7 +2811,7 @@ function drupal_get_library($module, $name = NULL) { * into a table. The table must have an ID attribute set. If using * theme_table(), the ID may be set as follows: * @code - * $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'my-module-table'))); + * $output = _theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'my-module-table'))); * return $output; * @endcode * @@ -3735,9 +3735,9 @@ function drupal_render_page($page) { * $elements['#sorted'] = TRUE to avoid sorting them a second time. * - The main render phase to produce #children for this element takes place: * - If this element has #theme defined and #theme is an implemented theme - * hook/suggestion then theme() is called and must render both the element - * and its children. If #render_children is set, theme() will not be - * called. #render_children is usually only set internally by theme() so + * hook/suggestion then _theme() is called and must render both the element + * and its children. If #render_children is set, _theme() will not be + * called. #render_children is usually only set internally by _theme() so * that we can avoid the situation where drupal_render() called from * within a theme preprocess function creates an infinite loop. * - If this element does not have a defined #theme, or the defined #theme @@ -3755,7 +3755,7 @@ function drupal_render_page($page) { * drupal_process_attached(). * - If this element has an array of #theme_wrappers defined and * #render_children is not set, #children is then re-rendered by passing the - * element in its current state to theme() successively for each item in + * element in its current state to _theme() successively for each item in * #theme_wrappers. Since #theme and #theme_wrappers hooks often define * variables with the same names it is possible to explicitly override each * attribute passed to each #theme_wrappers hook by setting the hook name as @@ -3815,7 +3815,7 @@ function drupal_render_page($page) { * The rendered HTML. * * @see element_info() - * @see theme() + * @see _theme() * @see drupal_process_states() * @see drupal_process_attached() */ @@ -3888,9 +3888,9 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) { // property is set, do not call the #theme function to prevent infinite // recursion. if ($theme_is_implemented && !isset($elements['#render_children'])) { - $elements['#children'] = theme($elements['#theme'], $elements); + $elements['#children'] = _theme($elements['#theme'], $elements); - // If theme() returns FALSE this means that the hook in #theme was not found + // If _theme() returns FALSE this means that the hook in #theme was not found // in the registry and so we need to update our flag accordingly. This is // common for theme suggestions. $theme_is_implemented = ($elements['#children'] !== FALSE); @@ -3935,7 +3935,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) { // If the value of a #theme_wrappers item is an array then the theme hook // is found in the key of the item and the value contains attribute // overrides. Attribute overrides replace key/value pairs in $elements for - // only this theme() call. This allows #theme hooks and #theme_wrappers + // only this _theme() call. This allows #theme hooks and #theme_wrappers // hooks to share variable names without conflict or ambiguity. $wrapper_elements = $elements; if (is_string($key)) { @@ -3948,7 +3948,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) { $wrapper_hook = $value; } - $elements['#children'] = theme($wrapper_hook, $wrapper_elements); + $elements['#children'] = _theme($wrapper_hook, $wrapper_elements); } } diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 4f5c923..9454285 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -215,7 +215,7 @@ function _drupal_log_error($error, $fatal = FALSE) { // We fallback to a maintenance page at this point, because the page generation // itself can generate errors. // Should not translate the string to avoid errors producing more errors. - $output = theme('maintenance_page', array('content' => 'The website has encountered an error. Please try again later.')); + $output = _theme('maintenance_page', array('content' => 'The website has encountered an error. Please try again later.')); $response = new Response($output, 500); if ($fatal) { diff --git a/core/includes/form.inc b/core/includes/form.inc index c53912c..256ee38 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -1576,7 +1576,7 @@ function theme_tableselect($variables) { array_unshift($header, ''); } } - return theme('table', array('header' => $header, 'rows' => $rows, 'empty' => $element['#empty'], 'attributes' => $element['#attributes'])); + return _theme('table', array('header' => $header, 'rows' => $rows, 'empty' => $element['#empty'], 'attributes' => $element['#attributes'])); } /** @@ -2774,13 +2774,13 @@ function theme_form_element($variables) { switch ($element['#title_display']) { case 'before': case 'invisible': - $output .= ' ' . theme('form_element_label', $variables); + $output .= ' ' . _theme('form_element_label', $variables); $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; break; case 'after': $output .= ' ' . $prefix . $element['#children'] . $suffix; - $output .= ' ' . theme('form_element_label', $variables) . "\n"; + $output .= ' ' . _theme('form_element_label', $variables) . "\n"; break; case 'none': @@ -2852,7 +2852,7 @@ function theme_form_element_label($variables) { } // If the element is required, a required marker is appended to the label. - $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : ''; + $required = !empty($element['#required']) ? _theme('form_required_marker', array('element' => $element)) : ''; $title = filter_xss_admin($element['#title']); diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 5a46c8c..57d3f19 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -978,9 +978,9 @@ function install_display_output($output, $install_state) { // Let the theming function know when every step of the installation has // been completed. $active_task = $install_state['installation_finished'] ? NULL : $install_state['active_task']; - drupal_add_region_content('sidebar_first', theme('task_list', array('items' => install_tasks_to_display($install_state), 'active' => $active_task, 'variant' => 'install'))); + drupal_add_region_content('sidebar_first', _theme('task_list', array('items' => install_tasks_to_display($install_state), 'active' => $active_task, 'variant' => 'install'))); } - print theme('install_page', array('content' => $output)); + print _theme('install_page', array('content' => $output)); exit; } @@ -2528,7 +2528,7 @@ function install_display_requirements($install_state, $requirements) { if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING && empty($install_state['parameters']['continue']))) { if ($install_state['interactive']) { drupal_set_title(t('Requirements problem')); - $status_report = theme('status_report', array('requirements' => $requirements)); + $status_report = _theme('status_report', array('requirements' => $requirements)); $status_report .= t('Check the messages and try again.', array('!url' => check_url(drupal_requirements_url($severity)))); return $status_report; } diff --git a/core/includes/pager.inc b/core/includes/pager.inc index 9874689..eba989b 100644 --- a/core/includes/pager.inc +++ b/core/includes/pager.inc @@ -36,10 +36,10 @@ function pager_find_page($element = 0) { } /** - * Initializes a pager for theme('pager'). + * Initializes a pager for _theme('pager'). * * This function sets up the necessary global variables so that future calls - * to theme('pager') will render a pager that correctly corresponds to the + * to _theme('pager') will render a pager that correctly corresponds to the * items being displayed. * * If the items being displayed result from a database query performed using @@ -67,10 +67,10 @@ function pager_find_page($element = 0) { * // Next, retrieve and display the items for the current page. * $offset = $num_per_page * $page; * $result = mymodule_select("SELECT * FROM data " . $where . " LIMIT %d, %d", $offset, $num_per_page)->fetchAll(); - * $output = theme('mymodule_results', array('result' => $result)); + * $output = _theme('mymodule_results', array('result' => $result)); * * // Finally, display the pager controls, and return. - * $output .= theme('pager'); + * $output .= _theme('pager'); * return $output; * @endcode * @@ -93,10 +93,10 @@ function pager_find_page($element = 0) { * pager_default_initialize($result->total, $num_per_page); * * // Display the search results. - * $output = theme('search_results', array('results' => $result->data, 'type' => 'remote')); + * $output = _theme('search_results', array('results' => $result->data, 'type' => 'remote')); * * // Finally, display the pager controls, and return. - * $output .= theme('pager'); + * $output .= _theme('pager'); * return $output; * @endcode * @@ -148,7 +148,7 @@ function pager_get_query_parameters() { * * Default template: pager.html.twig. * - * Menu callbacks that display paged query results should call theme('pager') to + * Menu callbacks that display paged query results should call _theme('pager') to * retrieve a pager control so that users can view other results. Format a list * of nearby pages with additional query results. * diff --git a/core/includes/tablesort.inc b/core/includes/tablesort.inc index 1f6962b..dd5ef43 100644 --- a/core/includes/tablesort.inc +++ b/core/includes/tablesort.inc @@ -9,7 +9,7 @@ * @file * Functions to aid in the creation of sortable tables. * - * All tables created with a call to theme('table') have the option of having + * All tables created with a call to _theme('table') have the option of having * column headers that the user can click on to sort the table by that column. */ @@ -50,7 +50,7 @@ function tablesort_header($cell, $header, $ts) { $cell['aria-sort'] = ($ts['sort'] == 'asc') ? 'ascending' : 'descending'; $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc'); $cell['class'][] = 'active'; - $image = theme('tablesort_indicator', array('style' => $ts['sort'])); + $image = _theme('tablesort_indicator', array('style' => $ts['sort'])); } else { // If the user clicks a different header, we want to sort ascending initially. diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5ca4d61..d1862ef 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -400,15 +400,15 @@ function drupal_find_base_themes($themes, $key) { * Generates themed output. * * All requests for themed output must go through this function (however, - * calling the theme() function directly is strongly discouraged - see next + * calling the _theme() function directly is strongly discouraged - see next * paragraph). It examines the request and routes it to the appropriate * @link themeable theme function or template @endlink, by checking the theme * registry. * * Avoid calling this function directly. It is preferable to replace direct - * calls to the theme() function with calls to drupal_render() by passing a + * calls to the _theme() function with calls to drupal_render() by passing a * render array with a #theme key to drupal_render(), which in turn calls - * theme(). + * _theme(). * * @section sec_theme_hooks Theme Hooks * Most commonly, the first argument to this function is the name of the theme @@ -472,21 +472,21 @@ function drupal_find_base_themes($themes, $key) { * hook_theme_suggestions_HOOK_alter() or the generic * hook_theme_suggestions_alter(). These alter hooks are used to manipulate an * array of suggested alternate theme hooks to use, in reverse order of - * priority. theme() will use the highest priority implementation that exists. - * If none exists, theme() will use the implementation for the theme hook it was + * priority. _theme() will use the highest priority implementation that exists. + * If none exists, _theme() will use the implementation for the theme hook it was * called with. These suggestions are similar to and are used for similar - * reasons as calling theme() with an array as the $hook parameter (see below). + * reasons as calling _theme() with an array as the $hook parameter (see below). * The difference is whether the suggestions are determined by the code that - * calls theme() or by altering the suggestions via the suggestion alter hooks. + * calls _theme() or by altering the suggestions via the suggestion alter hooks. * * @param $hook * The name of the theme hook to call. If the name contains a * double-underscore ('__') and there isn't an implementation for the full * name, the part before the '__' is checked. This allows a fallback to a - * more generic implementation. For example, if theme('links__node', ...) is + * more generic implementation. For example, if _theme('links__node', ...) is * called, but there is no implementation of that theme hook, then the * 'links' implementation is used. This process is iterative, so if - * theme('links__contextual__node', ...) is called, theme() checks for the + * _theme('links__contextual__node', ...) is called, _theme() checks for the * following implementations, and uses the first one that exists: * - links__contextual__node * - links__contextual @@ -494,7 +494,7 @@ function drupal_find_base_themes($themes, $key) { * This allows themes to create specific theme implementations for named * objects and contexts of otherwise generic theme hooks. The $hook parameter * may also be an array, in which case the first theme hook that has an - * implementation is used. This allows for the code that calls theme() to + * implementation is used. This allows for the code that calls _theme() to * explicitly specify the fallback order in a situation where using the '__' * convention is not desired or is insufficient. * @param $variables @@ -513,7 +513,7 @@ function drupal_find_base_themes($themes, $key) { * @see hook_theme() * @see template_preprocess() */ -function theme($hook, $variables = array()) { +function _theme($hook, $variables = array()) { static $default_attributes; // If called before all modules are loaded, we do not necessarily have a full // theme registry to work with, and therefore cannot process the theme @@ -557,7 +557,7 @@ function theme($hook, $variables = array()) { watchdog('theme', 'Theme hook %hook not found.', array('%hook' => $hook), WATCHDOG_WARNING); } // There is no theme implementation for the hook passed. Return FALSE so - // the function calling theme() can differentiate between a hook that + // the function calling _theme() can differentiate between a hook that // exists and renders an empty string and a hook that is not implemented. return FALSE; } @@ -621,7 +621,7 @@ function theme($hook, $variables = array()) { // Invoke hook_theme_suggestions_HOOK(). $suggestions = Drupal::moduleHandler()->invokeAll('theme_suggestions_' . $base_theme_hook, array($variables)); - // If theme() was invoked with a direct theme suggestion like + // If _theme() was invoked with a direct theme suggestion like // '#theme' => 'node__article', add it to the suggestions array before // invoking suggestion alter hooks. if (isset($info['base hook'])) { @@ -631,8 +631,8 @@ function theme($hook, $variables = array()) { Drupal::moduleHandler()->alter('theme_suggestions_' . $base_theme_hook, $suggestions, $variables); // Check if each suggestion exists in the theme registry, and if so, - // use it instead of the hook that theme() was called with. For example, a - // function may call theme('node', ...), but a module can add + // use it instead of the hook that _theme() was called with. For example, a + // function may call _theme('node', ...), but a module can add // 'node__article' as a suggestion via hook_theme_suggestions_HOOK_alter(), // enabling a theme to have an alternate template file for article nodes. foreach (array_reverse($suggestions) as $suggestion) { @@ -1323,7 +1323,7 @@ function theme_links($variables) { * to an empty string, but can be set to NULL for the attribute to be * omitted. Usually, neither omission nor an empty string satisfies * accessibility requirements, so it is strongly encouraged for code - * calling theme('image') to pass a meaningful value for this variable. + * calling _theme('image') to pass a meaningful value for this variable. * - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 * - http://www.w3.org/TR/xhtml1/dtds.html * - http://dev.w3.org/html5/spec/Overview.html#alt @@ -1962,10 +1962,10 @@ function _theme_table_cell($cell, $header = FALSE) { * This function is called for theme hooks implemented as templates only, not * for theme hooks implemented as functions. This preprocess function is the * first in the sequence of preprocessing functions that are called when - * preparing variables for a template. See theme() for more details about the + * preparing variables for a template. See _theme() for more details about the * full sequence. * - * @see theme() + * @see _theme() */ function template_preprocess(&$variables, $hook, $info) { // Tell all templates where they are located. @@ -2447,7 +2447,7 @@ function template_preprocess_maintenance_page(&$variables) { $variables['language'] = $language_interface; $variables['language']->dir = $language_interface->direction ? 'rtl' : 'ltr'; $variables['logo'] = theme_get_setting('logo.url'); - $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; + $variables['messages'] = $variables['show_messages'] ? _theme('status_messages') : ''; $variables['main_menu'] = array(); $variables['secondary_menu'] = array(); $variables['site_name'] = (theme_get_setting('features.name') ? String::checkPlain($site_name) : ''); @@ -2574,10 +2574,10 @@ function drupal_common_theme() { // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft // allows the alt attribute to be omitted in some cases. Therefore, // default the alt attribute to an empty string, but allow code calling - // theme('image') to pass explicit NULL for it to be omitted. Usually, + // _theme('image') to pass explicit NULL for it to be omitted. Usually, // neither omission nor an empty string satisfies accessibility // requirements, so it is strongly encouraged for code calling - // theme('image') to pass a meaningful value for the alt variable. + // _theme('image') to pass a meaningful value for the alt variable. // - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 // - http://www.w3.org/TR/xhtml1/dtds.html // - http://dev.w3.org/html5/spec/Overview.html#alt diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 96dcd2f..93a740a 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -162,9 +162,9 @@ function theme_authorize_report($variables) { if ($number === '#abort') { continue; } - $items[] = theme('authorize_message', array('message' => $log_message['message'], 'success' => $log_message['success'])); + $items[] = _theme('authorize_message', array('message' => $log_message['message'], 'success' => $log_message['success'])); } - $output .= theme('item_list', array('items' => $items, 'title' => $heading)); + $output .= _theme('item_list', array('items' => $items, 'title' => $heading)); } $output .= ''; } diff --git a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php index 65f26a0..f92831a 100644 --- a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php @@ -24,7 +24,7 @@ public function getImplementations($hook) { if (substr($hook, -6) === '_alter') { return array(); } - // theme() is called during updates and fires hooks, so whitelist the + // _theme() is called during updates and fires hooks, so whitelist the // system module. if (substr($hook, 0, 6) == 'theme_') { return array('system'); diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 3c5ada7..79a0d22 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -58,12 +58,12 @@ class Registry implements DestructableInterface { * from; e.g., 'module' for theme hook 'node' of Node module. * - name: The name of the extension the original theme hook originates * from; e.g., 'node' for theme hook 'node' of Node module. - * - theme path: The effective path_to_theme() during theme(), available as + * - theme path: The effective path_to_theme() during _theme(), available as * 'directory' variable in templates. * functions, it should point to the respective theme. For templates, * it should point to the directory that contains the template. * - includes: (optional) An array of include files to load when the theme - * hook is executed by theme(). + * hook is executed by _theme(). * - file: (optional) A filename to add to 'includes', either prefixed with * the value of 'path', or the path of the extension implementing * hook_theme(). @@ -290,7 +290,7 @@ public function getBaseHook($hook) { * for base hooks (e.g., 'block__node' for the base hook 'block') need to be * determined based on the full registry and classified as 'base hook'. * - * @see theme() + * @see _theme() * @see hook_theme_registry_alter() * * @return \Drupal\Core\Utility\ThemeRegistry @@ -373,7 +373,7 @@ protected function build() { * in hook_theme(). If there is more than one implementation and * 'render element' is not specified in a later one, then the previous * definition is kept. - * - 'preprocess functions': See theme() for detailed documentation. + * - 'preprocess functions': See _theme() for detailed documentation. * @param string $name * The name of the module, theme engine, base theme engine, theme or base * theme implementing hook_theme(). @@ -390,7 +390,7 @@ protected function build() { * The directory where $name is. For example, modules/system or * themes/bartik. * - * @see theme() + * @see _theme() * @see hook_theme() * @see list_themes() */ @@ -485,7 +485,7 @@ protected function processExtension(&$cache, $name, $type, $theme, $path) { } foreach ($prefixes as $prefix) { // Only use non-hook-specific variable preprocessors for theming - // hooks implemented as templates. See theme(). + // hooks implemented as templates. See _theme(). if (isset($info['template']) && function_exists($prefix . '_preprocess')) { $info['preprocess functions'][] = $prefix . '_preprocess'; } @@ -521,7 +521,7 @@ protected function processExtension(&$cache, $name, $type, $theme, $path) { $cache[$hook]['preprocess functions'] = array(); } // Only use non-hook-specific variable preprocessors for theme hooks - // implemented as templates. See theme(). + // implemented as templates. See _theme(). if (isset($info['template']) && function_exists($name . '_preprocess')) { $cache[$hook]['preprocess functions'][] = $name . '_preprocess'; } diff --git a/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php index 0979e07..0f7c0a7 100644 --- a/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -25,7 +25,7 @@ class ThemeRegistry extends CacheCollector implements DestructableInterface { /** * Whether the partial registry can be persisted to the cache. * - * This is only allowed if all modules and the request method is GET. theme() + * This is only allowed if all modules and the request method is GET. _theme() * should be very rarely called on POST requests and this avoids polluting * the runtime cache. */ diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index c6add64..065a1cd 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -20,7 +20,7 @@ * If the module wishes to act on the rendered HTML of the block rather than * the structured content array, it may use this hook to add a #post_render * callback. Alternatively, it could also implement hook_preprocess_HOOK() for - * block.html.twig. See drupal_render() and theme() documentation respectively + * block.html.twig. See drupal_render() and _theme() documentation respectively * for details. * * In addition to hook_block_view_alter(), which is called for all blocks, there diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php index 208710e..00abce4 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php @@ -69,7 +69,7 @@ public function testBlockNotInHiddenRegion() { // Ensure that "block_test_theme" is set as the default theme. $this->drupalGet('admin/structure/block'); - $this->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.'); + $this->assertText('Block test _theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.'); // Ensure that the search form block is displayed. $this->drupalGet(''); diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 7c1e7ee..40a26fa 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1344,7 +1344,7 @@ function template_preprocess_comment(&$variables) { $variables['commented_entity'] = $commented_entity; $account = comment_prepare_author($comment); - // @todo Do not call theme() here. We do this for purposes of t(). + // @todo Do not call _theme() here. We do this for purposes of t(). $username = array( '#theme' => 'username', '#account' => $account, @@ -1389,7 +1389,7 @@ function template_preprocess_comment(&$variables) { $comment_parent = $comment->pid->entity; $account_parent = comment_prepare_author($comment_parent); $variables['parent_comment'] = $comment_parent; - // @todo Do not call theme() here. We do this for purposes of t(). + // @todo Do not call _theme() here. We do this for purposes of t(). $username = array( '#theme' => 'username', '#account' => $account_parent, diff --git a/core/modules/image/image.module b/core/modules/image/image.module index d74c1ea..600869b 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -129,10 +129,10 @@ function image_theme() { // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft // allows the alt attribute to be omitted in some cases. Therefore, // default the alt attribute to an empty string, but allow code calling - // theme('image_style') to pass explicit NULL for it to be omitted. + // _theme('image_style') to pass explicit NULL for it to be omitted. // Usually, neither omission nor an empty string satisfies accessibility // requirements, so it is strongly encouraged for code calling - // theme('image_style') to pass a meaningful value for the alt variable. + // _theme('image_style') to pass a meaningful value for the alt variable. // - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 // - http://www.w3.org/TR/xhtml1/dtds.html // - http://dev.w3.org/html5/spec/Overview.html#alt @@ -335,7 +335,7 @@ function image_style_options($include_empty = TRUE) { * to an empty string, but can be set to NULL for the attribute to be * omitted. Usually, neither omission nor an empty string satisfies * accessibility requirements, so it is strongly encouraged for code calling - * theme('image_style') to pass a meaningful value for this variable. + * _theme('image_style') to pass a meaningful value for this variable. * - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 * - http://www.w3.org/TR/xhtml1/dtds.html * - http://dev.w3.org/html5/spec/Overview.html#alt diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index eb0dfe4..3e18c07 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -56,7 +56,7 @@ function locale_translate_import_form($form, &$form_state) { $form['file'] = array( '#type' => 'file', '#title' => t('Translation file'), - '#description' => theme('file_upload_help', array('description' => t('A Gettext Portable Object file.'), 'upload_validators' => $validators)), + '#description' => _theme('file_upload_help', array('description' => t('A Gettext Portable Object file.'), 'upload_validators' => $validators)), '#size' => 50, '#upload_validators' => $validators, '#attributes' => array('class' => array('file-import-input')), diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index d53673c..cbe18ba 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -823,7 +823,7 @@ function hook_node_view(\Drupal\Core\Entity\EntityInterface $node, \Drupal\Core\ * If the module wishes to act on the rendered HTML of the node rather than the * structured content array, it may use this hook to add a #post_render * callback. Alternatively, it could also implement hook_preprocess_HOOK() for - * node.html.twig. See drupal_render() and theme() documentation respectively + * node.html.twig. See drupal_render() and _theme() documentation respectively * for details. * * @param $build diff --git a/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php b/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php index 920f14b..471fd31 100644 --- a/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php +++ b/core/modules/search/tests/modules/search_extra_type/lib/Drupal/search_extra_type/Plugin/Search/SearchExtraTypeSearch.php @@ -77,7 +77,7 @@ public function buildResults() { '#plugin_id' => 'search_extra_type_search', ); } - $output['suffix']['#markup'] = '' . theme('pager'); + $output['suffix']['#markup'] = '' . _theme('pager'); return $output; } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index b7848de..83f57f9 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -290,7 +290,7 @@ protected function enableModules(array $modules) { // Update the kernel to make their services available. $this->kernel->updateModules($module_filenames, $module_filenames); - // Ensure isLoaded() is TRUE in order to make theme() work. + // Ensure isLoaded() is TRUE in order to make _theme() work. // Note that the kernel has rebuilt the container; this $module_handler is // no longer the $module_handler instance from above. $module_handler = $this->container->get('module_handler'); @@ -324,7 +324,7 @@ protected function disableModules(array $modules) { // Update the kernel to remove their services. $this->kernel->updateModules($module_filenames, $module_filenames); - // Ensure isLoaded() is TRUE in order to make theme() work. + // Ensure isLoaded() is TRUE in order to make _theme() work. // Note that the kernel has rebuilt the container; this $module_handler is // no longer the $module_handler instance from above. $module_handler = $this->container->get('module_handler'); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 8568672..21276f4 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -249,7 +249,7 @@ function testEnableModulesFixedList() { } /** - * Tests that theme() works right after loading a module. + * Tests that _theme() works right after loading a module. */ function testEnableModulesTheme() { $original_element = $element = array( @@ -258,7 +258,7 @@ function testEnableModulesTheme() { '#attributes' => array(), ); $this->enableModules(array('system')); - // theme() throws an exception if modules are not loaded yet. + // _theme() throws an exception if modules are not loaded yet. $this->assertTrue(drupal_render($element)); $element = $original_element; diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 265012e..dfb574e 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -2891,7 +2891,7 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') { * TRUE on pass, FALSE on fail. */ protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') { - $output = theme($callback, $variables); + $output = _theme($callback, $variables); $this->verbose('Variables:' . '
' .  check_plain(var_export($variables, TRUE)) . '
' . '
' . 'Result:' . '
' .  check_plain(var_export($output, TRUE)) . '
' . '
' . 'Expected:' . '
' .  check_plain(var_export($expected, TRUE)) . '
' diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index 3eb29dd..056ef2a 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -477,7 +477,7 @@ function hook_entity_view(\Drupal\Core\Entity\EntityInterface $entity, \Drupal\C * structured content array, it may use this hook to add a #post_render * callback. Alternatively, it could also implement hook_preprocess_HOOK() for * the particular entity type template, if there is one (e.g., node.html.twig). - * See drupal_render() and theme() for details. + * See drupal_render() and _theme() for details. * * @param $build * A renderable array representing the entity content. diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php index 1a9d3d1..61791a8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php @@ -27,7 +27,7 @@ public static function getInfo() { function testThemeTableStickyHeaders() { $header = array('one', 'two', 'three'); $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); - $this->content = theme('table', array('header' => $header, 'rows' => $rows, 'sticky' => TRUE)); + $this->content = _theme('table', array('header' => $header, 'rows' => $rows, 'sticky' => TRUE)); $js = _drupal_add_js(); $this->assertTrue(isset($js['core/misc/tableheader.js']), 'tableheader.js was included when $sticky = TRUE.'); $this->assertRaw('sticky-enabled', 'Table has a class of sticky-enabled when $sticky = TRUE.'); @@ -43,7 +43,7 @@ function testThemeTableNoStickyHeaders() { $attributes = array(); $caption = NULL; $colgroups = array(); - $this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE)); + $this->content = _theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE)); $js = _drupal_add_js(); $this->assertFalse(isset($js['core/misc/tableheader.js']), 'tableheader.js was not included because $sticky = FALSE.'); $this->assertNoRaw('sticky-enabled', 'Table does not have a class of sticky-enabled because $sticky = FALSE.'); @@ -62,7 +62,7 @@ function testThemeTableWithEmptyMessage() { 'colspan' => 2, ), ); - $this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.'))); + $this->content = _theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.'))); $this->assertRaw('No strings available.', 'Correct colspan was set on empty message.'); $this->assertRaw('Header 1', 'Table header was printed.'); } @@ -77,7 +77,7 @@ function testThemeTableWithNoStriping() { 'no_striping' => TRUE, ), ); - $this->content = theme('table', array('rows' => $rows)); + $this->content = _theme('table', array('rows' => $rows)); $this->assertNoRaw('class="odd"', 'Odd/even classes were not added because $no_striping = TRUE.'); $this->assertNoRaw('no_striping', 'No invalid no_striping HTML attribute was printed.'); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php index 492dfd6..2a6c70c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -41,7 +41,7 @@ function setUp() { * Render arrays that use a render element and templates (and hence call * template_preprocess()) must ensure the attributes at different occasions * are all merged correctly: - * - $variables['attributes'] as passed in to theme() + * - $variables['attributes'] as passed in to _theme() * - the render element's #attributes * - any attributes set in the template's preprocessing function */ @@ -58,20 +58,20 @@ function testAttributeMerging() { } /** - * Test that theme() returns expected data types. + * Test that _theme() returns expected data types. */ function testThemeDataTypes() { - // theme_test_false is an implemented theme hook so theme() should return a + // theme_test_false is an implemented theme hook so _theme() should return a // string, even though the theme function itself can return anything. $foos = array('null' => NULL, 'false' => FALSE, 'integer' => 1, 'string' => 'foo'); foreach ($foos as $type => $example) { - $output = theme('theme_test_foo', array('foo' => $example)); + $output = _theme('theme_test_foo', array('foo' => $example)); $this->assertTrue(is_string($output), format_string('theme() returns a string for data type !type.', array('!type' => $type))); } - // suggestionnotimplemented is not an implemented theme hook so theme() + // suggestionnotimplemented is not an implemented theme hook so _theme() // should return FALSE instead of a string. - $output = theme(array('suggestionnotimplemented')); + $output = _theme(array('suggestionnotimplemented')); $this->assertIdentical($output, FALSE, 'theme() returns FALSE when a hook suggestion is not implemented.'); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php index 3a26efe..273b7fb 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php @@ -48,9 +48,9 @@ function testTwigDebugMarkup() { // Create a node and test different features of the debug markup. $node = $this->drupalCreateNode(); - $output = theme('node', node_view($node)); + $output = _theme('node', node_view($node)); $this->assertTrue(strpos($output, '') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.'); - $this->assertTrue(strpos($output, "CALL: theme('node')") !== FALSE, 'Theme call information found.'); + $this->assertTrue(strpos($output, "CALL: _theme('node')") !== FALSE, 'Theme call information found.'); $this->assertTrue(strpos($output, 'x node--1' . $extension) !== FALSE, 'Node ID specific template shown as current template.'); $this->assertTrue(strpos($output, '* node' . $extension) !== FALSE, 'Base template file found.'); $template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension; @@ -59,7 +59,7 @@ function testTwigDebugMarkup() { // Create another node and make sure the template suggestions shown in the // debug markup are correct. $node2 = $this->drupalCreateNode(); - $output = theme('node', node_view($node2)); + $output = _theme('node', node_view($node2)); $this->assertTrue(strpos($output, '* node--2' . $extension) !== FALSE, 'Node ID specific template suggestion found.'); $this->assertTrue(strpos($output, 'x node' . $extension) !== FALSE, 'Base template file shown as current template.'); @@ -68,7 +68,7 @@ function testTwigDebugMarkup() { $this->rebuildContainer(); $this->resetAll(); - $output = theme('node', node_view($node)); + $output = _theme('node', node_view($node)); $this->assertFalse(strpos($output, '') !== FALSE, 'Twig debug markup not found in theme output when debug is disabled.'); } diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index ae1b38e..30cae39 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -805,7 +805,7 @@ function hook_page_alter(&$page) { * * The call order is as follows: all existing form alter functions are called * for module A, then all for module B, etc., followed by all for any base - * theme(s), and finally for the theme itself. The module order is determined + * _theme(s), and finally for the theme itself. The module order is determined * by system weight, then by module name. * * Within each module, form alter hooks are called in the following order: @@ -1222,8 +1222,8 @@ function hook_permission() { * - They can specify how a particular render array is to be rendered as HTML. * This is usually the case if the theme function is assigned to the render * array's #theme property. - * - They can return HTML for default calls to theme(). - * - They can return HTML for calls to theme() for a theme suggestion. + * - They can return HTML for default calls to _theme(). + * - They can return HTML for calls to _theme() for a theme suggestion. * * @param array $existing * An array of existing implementations that may be used for override @@ -1250,18 +1250,18 @@ function hook_permission() { * @return array * An associative array of information about theme implementations. The keys * on the outer array are known as "theme hooks". For simple theme - * implementations for regular calls to theme(), the theme hook is the first + * implementations for regular calls to _theme(), the theme hook is the first * argument. For theme suggestions, instead of the array key being the base * theme hook, the key is a theme suggestion name with the format * 'base_hook_name__sub_hook_name'. For render elements, the key is the * machine name of the render element. The array values are themselves arrays * containing information about the theme hook and its implementation. Each - * information array must contain either a 'variables' element (for theme() + * information array must contain either a 'variables' element (for _theme() * calls) or a 'render element' element (for render elements), but not both. * The following elements may be part of each information array: - * - variables: Used for theme() call items only: an array of variables, + * - variables: Used for _theme() call items only: an array of variables, * where the array keys are the names of the variables, and the array - * values are the default values if they are not passed into theme(). + * values are the default values if they are not passed into _theme(). * Template implementations receive each array key as a variable in the * template file (so they must be legal PHP/Twig variable names). Function * implementations are passed the variables in a single $variables function @@ -1289,7 +1289,7 @@ function hook_permission() { * registers the 'node' theme hook, 'theme_node' will be assigned to its * function. If the chameleon theme registers the node hook, it will be * assigned 'chameleon_node' as its function. - * - base hook: Used for theme() suggestions only: the base theme hook name. + * - base hook: Used for _theme() suggestions only: the base theme hook name. * Instead of this suggestion's implementation being used directly, the base * hook will be invoked with this implementation as its first suggestion. * The base hook's files will be included and the base hook's preprocess @@ -1299,14 +1299,14 @@ function hook_permission() { * suggestion may be used in place of this suggestion. If after * hook_theme_suggestions_HOOK() this suggestion remains the first * suggestion, then this suggestion's function or template will be used to - * generate the output for theme(). + * generate the output for _theme(). * - pattern: A regular expression pattern to be used to allow this theme * implementation to have a dynamic name. The convention is to use __ to * differentiate the dynamic portion of the theme. For example, to allow * forums to be themed individually, the pattern might be: 'forum__'. Then, * when the forum is themed, call: * @code - * theme(array('forum__' . $tid, 'forum'), $forum) + * _theme(array('forum__' . $tid, 'forum'), $forum) * @endcode * - preprocess functions: A list of functions used to preprocess this data. * Ordinarily this won't be used; it's automatically filled in. By default, diff --git a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/EventSubscriber/ThemeTestSubscriber.php b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/EventSubscriber/ThemeTestSubscriber.php index 2e5417d..9238fed 100644 --- a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/EventSubscriber/ThemeTestSubscriber.php +++ b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/EventSubscriber/ThemeTestSubscriber.php @@ -42,7 +42,7 @@ public function onRequest(GetResponseEvent $event) { // theme_test_request_listener_page_callback() to test that even when the // theme system is initialized this early, it is still capable of // returning output and theming the page as a whole. - $GLOBALS['theme_test_output'] = theme('more_link', array('url' => 'user', 'title' => 'Themed output generated in a KernelEvents::REQUEST listener')); + $GLOBALS['theme_test_output'] = _theme('more_link', array('url' => 'user', 'title' => 'Themed output generated in a KernelEvents::REQUEST listener')); } } diff --git a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php index 8da6c62..62b7a25 100644 --- a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php +++ b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php @@ -55,7 +55,7 @@ public function testInfoStylesheets() { * A render array containing a theme override. */ public function testTemplate() { - return theme('theme_test_template_test'); + return _theme('theme_test_template_test'); } /** @@ -65,12 +65,12 @@ public function testTemplate() { * An HTML string containing the themed output. */ public function testSuggestion() { - return theme(array('theme_test__suggestion', 'theme_test'), array()); + return _theme(array('theme_test__suggestion', 'theme_test'), array()); } /** * This is for testing that the theme can have hook_*_alter() implementations - * that run during page callback execution, even before theme() is called for + * that run during page callback execution, even before _theme() is called for * the first time. * * @return string diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module index b8a528d..4a0415c 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -98,14 +98,14 @@ function theme_test_page_alter(&$page) { } /** - * Theme function for testing theme('theme_test_foo'). + * Theme function for testing _theme('theme_test_foo'). */ function theme_theme_test_foo($variables) { return $variables['foo']; } /** - * Theme function for testing theme('theme_test_function_template_override'). + * Theme function for testing _theme('theme_test_function_template_override'). */ function theme_theme_test_function_template_override($variables) { return 'theme_test_function_template_override test failed.'; @@ -128,7 +128,7 @@ function template_preprocess_theme_test_render_element(&$variables) { * Theme function for testing rendering of child elements via drupal_render(). * * Theme hooks defining a 'render element' add an internal '#render_children' - * property. When this property is found, drupal_render() avoids calling theme() + * property. When this property is found, drupal_render() avoids calling _theme() * on the top-level element to prevent infinite recursion. * * @param array $variables diff --git a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php index 9179de9..ddbab35 100644 --- a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php +++ b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php @@ -26,7 +26,7 @@ public static function create(ContainerInterface $container) { * Menu callback for testing PHP variables in a Twig template. */ public function phpVariablesRender() { - return theme('twig_theme_test_php_variables'); + return _theme('twig_theme_test_php_variables'); } /** diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php index 34758da..22a27e9 100644 --- a/core/modules/system/theme.api.php +++ b/core/modules/system/theme.api.php @@ -9,14 +9,14 @@ * layer. Each theme can take control over most of Drupal's output, and * has complete control over the CSS. * - * Inside Drupal, the theme layer is utilized by the use of the theme() + * Inside Drupal, the theme layer is utilized by the use of the _theme() * function, which is passed the name of a component (the theme hook) * and an array of variables. For example, - * theme('table', array('header' => $header, 'rows' => $rows)); - * Additionally, the theme() function can take an array of theme + * _theme('table', array('header' => $header, 'rows' => $rows)); + * Additionally, the _theme() function can take an array of theme * hooks, which can be used to provide 'fallback' implementations to * allow for more specific control of output. For example, the function: - * theme(array('table__foo', 'table'), $variables) would look to see if + * _theme(array('table__foo', 'table'), $variables) would look to see if * 'table__foo' is registered anywhere; if it is not, it would 'fall back' * to the generic 'table' implementation. This can be used to attach specific * theme functions to named objects, allowing the themer more control over @@ -55,7 +55,7 @@ * * The theme system is described and defined in theme.inc. * - * @see theme() + * @see _theme() * @see hook_theme() * @see hooks * @see callbacks @@ -98,7 +98,7 @@ function hook_form_system_theme_settings_alter(&$form, &$form_state) { * preprocess variables for a specific theme hook, whether implemented as a * template or function. * - * For more detailed information, see theme(). + * For more detailed information, see _theme(). * * @param $variables * The variables array (modify in place). @@ -146,7 +146,7 @@ function hook_preprocess(&$variables, $hook) { * hook. It should only be used if a module needs to override or add to the * theme preprocessing for a theme hook it didn't define. * - * For more detailed information, see theme(). + * For more detailed information, see _theme(). * * @param $variables * The variables array (modify in place). diff --git a/core/modules/taxonomy/taxonomy.api.php b/core/modules/taxonomy/taxonomy.api.php index 5ddc3c0..ee804583 100644 --- a/core/modules/taxonomy/taxonomy.api.php +++ b/core/modules/taxonomy/taxonomy.api.php @@ -282,7 +282,7 @@ function hook_taxonomy_term_view(\Drupal\taxonomy\Entity\Term $term, \Drupal\Cor * structured content array, it may use this hook to add a #post_render * callback. Alternatively, it could also implement * hook_preprocess_HOOK() for taxonomy-term.html.twig. See drupal_render() and - * theme() documentation respectively for details. + * _theme() documentation respectively for details. * * @param $build * A renderable array representing the taxonomy term content. diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index 19c0dc1..79720e7 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -178,9 +178,9 @@ function update_manager_update_form($form, $form_state = array(), $context) { if ($needs_manual) { // There are no checkboxes in the 'Manual updates' table so it will be - // rendered by theme('table'), not theme('tableselect'). Since the data + // rendered by _theme('table'), not _theme('tableselect'). Since the data // formats are incompatible, we convert now to the format expected by - // theme('table'). + // _theme('table'). unset($entry['#weight']); $attributes = $entry['#attributes']; unset($entry['#attributes']); diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php index 2d2fbd9..2f4fc75 100644 --- a/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -346,7 +346,7 @@ function hook_user_view(\Drupal\user\UserInterface $account, \Drupal\Core\Entity * If the module wishes to act on the rendered HTML of the user rather than the * structured content array, it may use this hook to add a #post_render callback. * Alternatively, it could also implement hook_preprocess_HOOK() for - * user.html.twig. See drupal_render() and theme() documentation + * user.html.twig. See drupal_render() and _theme() documentation * respectively for details. * * @param $build diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php index db4a5d8..5d9782e 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php @@ -1591,7 +1591,7 @@ protected function addSelfTokens(&$tokens, $item) { } protected function documentSelfTokens(&$tokens) { } /** - * Call out to the theme() function, which probably just calls render() but + * Call out to the _theme() function, which probably just calls render() but * allows sites to override output fairly easily. * * @param \Drupal\views\ResultRow $values @@ -1601,7 +1601,7 @@ protected function documentSelfTokens(&$tokens) { } * Returns rendered output of the given theme implementation. */ function theme(ResultRow $values) { - return theme($this->themeFunctions(), + return _theme($this->themeFunctions(), array( 'view' => $this->view, 'field' => $this, diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php index 9c3b7ff..ded2c60 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php @@ -171,7 +171,7 @@ public function render($row) { } } - return theme($this->themeFunctions(), + return _theme($this->themeFunctions(), array( 'view' => $this->view, 'options' => $this->options, diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php index adb23b2..25a29ff 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php @@ -134,7 +134,7 @@ public function render() { $rows .= $this->view->rowPlugin->render($row); } - $output = theme($this->themeFunctions(), + $output = _theme($this->themeFunctions(), array( 'view' => $this->view, 'options' => $this->options, diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index 23e245c..a317124 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -35,7 +35,7 @@ function twig_init($template) { /** * Renders a Twig template. * - * If the Twig debug setting is enabled, HTML comments including theme() call + * If the Twig debug setting is enabled, HTML comments including _theme() call * and template file name suggestions will surround the template markup. * * @param $template_file @@ -56,7 +56,7 @@ function twig_render_template($template_file, $variables) { ); if (settings()->get('twig_debug', FALSE)) { $output['debug_prefix'] .= "\n\n"; - $output['debug_prefix'] .= "\n"; + $output['debug_prefix'] .= "\n"; if (!empty($variables['theme_hook_suggestions'])) { $extension = twig_extension(); $current_template = basename($template_file); -- 1.8.2