diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index e11d366..8e1807c 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -219,7 +219,8 @@ * @code * $commands = array(); * $commands[] = ajax_command_replace(NULL, $output); - * $commands[] = ajax_command_prepend(NULL, theme('status_messages')); + * $status_messages = array('#theme' => 'status_messages'); + * $commands[] = ajax_command_prepend(NULL, drupal_render($status_messages)); * return array('#type' => 'ajax', '#commands' => $commands); * @endcode * diff --git a/core/includes/common.inc b/core/includes/common.inc index d203772..fdb6d6f 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1376,7 +1376,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. * @@ -2822,8 +2822,15 @@ 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'))); - * return $output; + * $table = array( + * '#type' => 'table', + * '#header' => $header, + * '#rows' => $rows, + * '#attributes' => array( + * 'id' => 'my-module-table' + * ) + * ); + * return drupal_render($table); * @endcode * * In the theme function for the form, a special class must be added to each @@ -3654,9 +3661,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 @@ -3674,7 +3681,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 @@ -3734,7 +3741,7 @@ function drupal_render_page($page) { * The rendered HTML. * * @see element_info() - * @see theme() + * @see _theme() * @see drupal_process_states() * @see drupal_process_attached() */ @@ -3807,11 +3814,11 @@ 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 - // in the registry and so we need to update our flag accordingly. This is - // common for theme suggestions. + // 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); } @@ -3854,7 +3861,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)) { @@ -3867,7 +3874,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/pager.inc b/core/includes/pager.inc index 9874689..7fb19b0 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,14 @@ 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 = drupal_render( + * '#theme' => 'mymodule_results', + * '#result' => $result + * ); * * // Finally, display the pager controls, and return. - * $output .= theme('pager'); + * $pager = array('#theme' => 'pager'); + * $output .= drupal_render($pager); * return $output; * @endcode * @@ -93,10 +97,16 @@ 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')); + * $search_results = array( + * '#theme' => 'search_results', + * '#results' => $result->data, + * '#type' => 'remote', + * ); + * $output = drupal_render($search_results); * * // Finally, display the pager controls, and return. - * $output .= theme('pager'); + * $pager = array('#theme' => 'pager'); + * $output .= drupal_render($pager); * return $output; * @endcode * @@ -148,9 +158,9 @@ function pager_get_query_parameters() { * * Default template: pager.html.twig. * - * 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. + * 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. * * @param array $variables * An associative array containing: diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 4ebe08a..aa558b2 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -401,15 +401,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 - * paragraph). It examines the request and routes it to the appropriate + * calling the _theme() function directly is very 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 @@ -473,21 +473,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 - * 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). + * 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). * 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 @@ -495,7 +495,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 @@ -514,13 +514,13 @@ 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 // request properly. See also \Drupal\Core\Theme\Registry::get(). if (!\Drupal::moduleHandler()->isLoaded() && !defined('MAINTENANCE_MODE')) { - throw new Exception(t('theme() may not be called until all modules are loaded.')); + throw new Exception(t('_theme() may not be called until all modules are loaded.')); } /** @var \Drupal\Core\Utility\ThemeRegistry $theme_registry */ @@ -558,7 +558,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; } @@ -622,7 +622,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'])) { @@ -638,8 +638,8 @@ function theme($hook, $variables = array()) { \Drupal::moduleHandler()->alter($hooks, $suggestions, $variables, $base_theme_hook); // 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) { @@ -1352,7 +1352,7 @@ function template_preprocess_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 @@ -1956,10 +1956,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. @@ -2580,10 +2580,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/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php index a8334b8..828508b 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 b0fed73..1d3cb22 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -59,12 +59,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(). @@ -291,7 +291,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 @@ -374,7 +374,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(). @@ -391,7 +391,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() */ @@ -486,7 +486,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'; } @@ -522,7 +522,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 8d3e1f8..dbd44e9 100644 --- a/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -26,7 +26,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/comment/comment.module b/core/modules/comment/comment.module index cb98f72..541ae92 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1395,7 +1395,6 @@ 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(). $username = array( '#theme' => 'username', '#account' => $account, @@ -1446,7 +1445,6 @@ function template_preprocess_comment(&$variables) { $comment_parent = $comment->getParentComment(); $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(). $username = array( '#theme' => 'username', '#account' => $account_parent, diff --git a/core/modules/image/image.module b/core/modules/image/image.module index e5f52ed..00c2690 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -143,10 +143,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 @@ -349,7 +349,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/node/node.api.php b/core/modules/node/node.api.php index ab7811e..20f6257 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -820,7 +820,7 @@ function hook_node_view(\Drupal\node\NodeInterface $node, \Drupal\Core\Entity\Di * 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/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index d44064e..cab4b9e 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -358,7 +358,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'); @@ -392,7 +392,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 d8275d3..f2beeaa 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 af66791..702ef69 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -2994,7 +2994,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)) . '' . '
' . check_plain(var_export($output, TRUE)) . '' . '
' . check_plain(var_export($expected, TRUE)) . '' diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index 1a3973d..84bfad8 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/form.api.php b/core/modules/system/form.api.php index 36c4c85..5ae2d69 100644 --- a/core/modules/system/form.api.php +++ b/core/modules/system/form.api.php @@ -110,7 +110,11 @@ function callback_batch_finished($success, $results, $operations) { $message = t("!count items were processed.", array( '!count' => count($results), )); - $message .= theme('item_list', array('items' => $results)); + $list = array( + '#theme' => 'item_list', + '#items' => $results, + ); + $message .= drupal_render($list); drupal_set_message($message); } else { 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..a5502e7 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,13 @@ 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)); + $table = array( + '#type' => 'table', + '#header' => $header, + '#rows' => $rows, + '#sticky' => TRUE, + ); + $this->content = drupal_render($table); $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 +49,16 @@ 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)); + $table = array( + '#type' => 'table', + '#header' => $header, + '#rows' => $rows, + '#attributes' => $attributes, + '#caption' => $caption, + '#colgroups' => $colgroups, + '#sticky' => FALSE, + ); + $this->content = drupal_render($table); $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 +77,13 @@ function testThemeTableWithEmptyMessage() { 'colspan' => 2, ), ); - $this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.'))); + $table = array( + '#type' => 'table', + '#header' => $header, + '#rows' => array(), + '#empty' => t('No strings available.'), + ); + $this->content = drupal_render($table); $this->assertRaw('