diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php index af48c1f..e67453d 100644 --- a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php +++ b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php @@ -53,7 +53,11 @@ public function __construct(SystemManager $systemManager) { public function status() { $requirements = $this->systemManager->listRequirements(); $this->systemManager->fixAnonymousUid(); - return theme('status_report', array('requirements' => $requirements)); + $status_report = array( + '#theme' => 'status_report', + '#requirements' => $requirements, + ); + return drupal_render($status_report); } /** diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemPoweredByBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemPoweredByBlock.php index 7edd34b..710034a 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemPoweredByBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemPoweredByBlock.php @@ -26,9 +26,7 @@ class SystemPoweredByBlock extends BlockBase { * {@inheritdoc} */ public function build() { - return array( - '#children' => theme('system_powered_by'), - ); + return array('#theme' => 'system_powered_by'); } } 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 1cea46a..e9748e5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TableTest.php @@ -25,9 +25,13 @@ public static function getInfo() { * Tableheader.js provides 'sticky' table headers, and is included by default. */ 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( + '#theme' => 'table', + '#header' => array('one', 'two', 'three'), + '#rows' => array(array(1,2,3), array(4,5,6), array(7,8,9)), + '#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.'); @@ -38,12 +42,16 @@ function testThemeTableStickyHeaders() { * If $sticky is FALSE, no tableheader.js should be included. */ function testThemeTableNoStickyHeaders() { - $header = array('one', 'two', 'three'); - $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); - $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( + '#theme' => 'table', + '#header' => array('one', 'two', 'three'), + '#rows' => array(array(1,2,3), array(4,5,6), array(7,8,9)), + '#attributes' => array(), + '#caption' => NULL, + '#colgroups' => array(), + '#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 +70,13 @@ function testThemeTableWithEmptyMessage() { 'colspan' => 2, ), ); - $this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.'))); + $table = array( + '#theme' => 'table', + '#header' => $header, + '#rows' => array(), + '#empty' => t('No strings available.'), + ); + $this->content = drupal_render($table); $this->assertRaw('No strings available.', 'Correct colspan was set on empty message.'); $this->assertRaw('Header 1', 'Table header was printed.'); } @@ -77,7 +91,11 @@ function testThemeTableWithNoStriping() { 'no_striping' => TRUE, ), ); - $this->content = theme('table', array('rows' => $rows)); + $table = array( + '#theme' => 'table', + '#rows' => $rows, + ); + $this->content = drupal_render($table); $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/TwigDebugMarkupTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php index 38e183b..94c8238 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php @@ -52,7 +52,8 @@ function testTwigDebugMarkup() { // Create a node and test different features of the debug markup. $node = $this->drupalCreateNode(); - $output = theme('node', node_view($node)); + $node_view = node_view($node); + $output = drupal_render($node_view); $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, 'x node--1' . $extension) !== FALSE, 'Node ID specific template shown as current template.'); @@ -63,7 +64,8 @@ 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)); + $node_view2 = node_view($node2); + $output = drupal_render($node_view2); $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.'); @@ -72,7 +74,8 @@ function testTwigDebugMarkup() { $this->rebuildContainer(); $this->resetAll(); - $output = theme('node', node_view($node)); + $node_view = node_view($node); + $output = drupal_render($node_view); $this->assertFalse(strpos($output, '') !== FALSE, 'Twig debug markup not found in theme output when debug is disabled.'); } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index aa36ba7..5ed1f53 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -43,8 +43,11 @@ function system_admin_config_page() { unset($item['localized_options']['attributes']['title']); } $block = $item; - $block['content'] = ''; - $block['content'] .= theme('admin_block_content', array('content' => system_admin_menu_block($item))); + $admin_block_content = array( + '#theme' => 'admin_block_content', + '#content' => system_admin_menu_block($item), + ); + $block['content'] = drupal_render($admin_block_content); if (!empty($block['content'])) { $block['show'] = TRUE; } @@ -57,7 +60,11 @@ function system_admin_config_page() { } if ($blocks) { ksort($blocks); - return theme('admin_page', array('blocks' => $blocks)); + $admin_page = array( + '#theme' => 'admin_page', + '#blocks' => $blocks, + ); + return drupal_render($admin_page); } else { return t('You do not have any administrative items.'); @@ -77,8 +84,9 @@ function system_admin_config_page() { */ function system_admin_menu_block_page() { $item = menu_get_item(); - if ($content = system_admin_menu_block($item)) { - $output = theme('admin_block_content', array('content' => $content)); + $admin_block_content = array('#theme' => 'admin_block_content'); + if ($admin_block_content['#content'] = system_admin_menu_block($item)) { + $output = drupal_render($admin_block_content); } else { $output = t('You do not have any administrative items.'); @@ -213,7 +221,12 @@ function system_themes_page() { drupal_alter('system_themes_page', $theme_groups); $admin_form = drupal_get_form('system_themes_admin_form', $admin_theme_options); - return theme('system_themes_page', array('theme_groups' => $theme_groups, 'theme_group_titles' => $theme_group_titles)) . drupal_render($admin_form); + $system_themes_page = array( + '#theme' => 'system_themes_page', + '#theme_groups' => $theme_groups, + '#theme_group_titles' => $theme_group_titles, + ); + return drupal_render($system_themes_page) . drupal_render($admin_form); } /** @@ -462,7 +475,11 @@ function theme_admin_page($variables) { $container = array(); foreach ($blocks as $block) { - if ($block_output = theme('admin_block', array('block' => $block))) { + $admin_block = array( + '#theme' => 'admin_block', + '#block' => $block, + ); + if ($block_output = drupal_render($admin_block)) { if (empty($block['position'])) { // perform automatic striping. $block['position'] = ++$stripe % 2 ? 'left' : 'right'; @@ -474,8 +491,9 @@ function theme_admin_page($variables) { } } + $system_compact_link = array('#theme' => 'system_compact_link'); $output = '
'; - $output .= theme('system_compact_link'); + $output .= drupal_render($system_compact_link); foreach ($container as $id => $data) { $output .= '
'; @@ -509,13 +527,21 @@ function theme_system_admin_index($variables) { // Output links. if (count($items)) { + $admin_block_content = array( + '#theme' => 'admin_block_content', + '#content' => $items, + ); $block = array(); $block['title'] = $module; - $block['content'] = theme('admin_block_content', array('content' => $items)); + $block['content'] = drupal_render($admin_block_content); $block['description'] = t($description); $block['show'] = TRUE; - if ($block_output = theme('admin_block', array('block' => $block))) { + $admin_block = array( + '#theme' => 'admin_block', + '#block' => $block, + ); + if ($block_output = drupal_render($admin_block)) { if (!isset($block['position'])) { // Perform automatic striping. $block['position'] = $position; @@ -526,8 +552,9 @@ function theme_system_admin_index($variables) { } } + $system_compact_link = array('#theme' => 'system_compact_link'); $output = '
'; - $output .= theme('system_compact_link'); + $output .= drupal_render($system_compact_link); foreach ($container as $id => $data) { $output .= '
'; $output .= $data; @@ -677,7 +704,12 @@ function theme_system_modules_details($variables) { $rows[] = $row; } - return theme('table', array('header' => $form['#header'], 'rows' => $rows)); + $table = array( + '#theme' => 'table', + '#header' => $form['#header'], + '#rows' => $rows, + ); + return drupal_render($table); } /** @@ -736,7 +768,13 @@ function theme_system_modules_uninstall($variables) { ); } - $output = theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No modules are available to uninstall.'))); + $table = array( + '#theme' => 'table', + '#header' => $header, + '#rows' => $rows, + '#empty' => t('No modules are available to uninstall.'), + ); + $output = drupal_render($table); $output .= drupal_render_children($form); return $output; @@ -748,6 +786,7 @@ function theme_system_modules_uninstall($variables) { * @param $variables * An associative array containing: * - theme_groups: An associative array containing groups of themes. + * - theme_group_titles: An associative array containing titles of themes. * * @ingroup themeable */ @@ -855,7 +894,12 @@ function system_date_format_language_overview_page() { $rows[] = $row; } - return theme('table', array('header' => $header, 'rows' => $rows)); + $table = array( + '#theme' => 'table', + '#header' => $header, + '#rows' => $rows, + ); + return drupal_render($table); } /** @@ -963,8 +1007,13 @@ function theme_system_date_format_localize_form($variables) { $rows[] = $row; } + $table = array( + '#theme' => 'table', + '#header' => $header, + '#rows' => $rows, + ); $output = drupal_render($form['language']); - $output .= theme('table', array('header' => $header, 'rows' => $rows)); + $output .= drupal_render($table); $output .= drupal_render_children($form); return $output; diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index d395462..555d2c5 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -410,7 +410,8 @@ function hook_css_alter(&$css) { */ function hook_ajax_render_alter($commands) { // Inject any new status messages into the content area. - $commands[] = ajax_command_prepend('#block-system-main .content', theme('status_messages')); + $status_messages = array('#theme' => 'status_messages'); + $commands[] = ajax_command_prepend('#block-system-main .content', drupal_render($status_messages)); } /** diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 6c170da..305bf99 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -131,7 +131,11 @@ function system_requirements($phase) { '@system_requirements' => 'http://drupal.org/requirements', )); - $description .= theme('item_list', array('items' => $missing_extensions)); + $item_list = array( + '#theme' => 'item_list', + '#items' => $missing_extensions, + ); + $description .= drupal_render($item_list); $requirements['php_extensions']['value'] = t('Disabled'); $requirements['php_extensions']['severity'] = REQUIREMENT_ERROR; @@ -246,7 +250,11 @@ function system_requirements($phase) { $description = $conf_errors[0]; } else { - $description = theme('item_list', array('items' => $conf_errors)); + $item_list = array( + '#theme' => 'item_list', + '#items' => $conf_errors, + ); + $description = drupal_render($item_list); } $requirements['settings.php'] = array( 'value' => t('Not protected'), diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 5d015ce..474da34 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -139,7 +139,10 @@ function system_help($path, $arg) { function system_theme() { return array_merge(drupal_common_theme(), array( 'system_themes_page' => array( - 'variables' => array('theme_groups' => NULL), + 'variables' => array( + 'theme_groups' => NULL, + 'theme_group_titles' => NULL, + ), 'file' => 'system.admin.inc', ), 'system_config_form' => array( @@ -3418,7 +3421,12 @@ function theme_exposed_filters($variables) { foreach (element_children($form['current']) as $key) { $items[] = $form['current'][$key]; } - $output .= theme('item_list', array('items' => $items, 'attributes' => array('class' => array('clearfix', 'current-filters')))); + $item_list = array( + '#theme' => 'item_list', + '#items' => $items, + '#attributes' => array('class' => array('clearfix', 'current-filters')), + ); + $output .= drupal_render($item_list); } $output .= drupal_render_children($form); 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 bea8b13..3bfe755 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 @@ -34,7 +34,12 @@ 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')); + $more_link = array( + '#theme' => 'more_link', + '#url' => 'user', + '#title' => 'Themed output generated in a KernelEvents::REQUEST listener', + ); + $GLOBALS['theme_test_output'] = drupal_render($more_link); } if (strpos($current_path, 'user/autocomplete') === 0) { // Register a fake registry loading callback. If it gets called by 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 51cb6d3..13a0243 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -9,9 +9,11 @@ function theme_test_theme($existing, $type, $theme, $path) { 'variables' => array('foo' => ''), ); $items['theme_test_template_test'] = array( + 'variables' => array(), 'template' => 'theme_test.template_test', ); $items['theme_test_template_test_2'] = array( + 'variables' => array(), 'template' => 'theme_test.template_test', ); $items['theme_test_foo'] = array( @@ -100,7 +102,8 @@ function theme_test_request_listener_page_callback() { * Menu callback for testing template overridding based on filename. */ function theme_test_template_test_page_callback() { - return theme('theme_test_template_test'); + $theme_test_template_test = array('#theme' => 'theme_test_template_test'); + return drupal_render($theme_test_template_test); } /** @@ -146,7 +149,8 @@ function _theme_test_alter() { * Page callback, calls a theme hook suggestion. */ function _theme_test_suggestion() { - return theme(array('theme_test__suggestion', 'theme_test'), array()); + $theme_test = array('#theme' => array('theme_test__suggestion', 'theme_test')); + return drupal_render($theme_test); } /** 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 6eb318a..e4ba607 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,8 @@ 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'); + $twig_theme_test_php_variables = array('#theme' => 'twig_theme_test_php_variables'); + return drupal_render($twig_theme_test_php_variables); } /** diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module index 934d1b0..cc74184 100644 --- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module +++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module @@ -5,6 +5,7 @@ */ function twig_theme_test_theme($existing, $type, $theme, $path) { $items['twig_theme_test_php_variables'] = array( + 'variables' => array(), 'template' => 'twig_theme_test.php_variables', ); $items['twig_theme_test_trans'] = array( diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php index aedc6b0..b25636c 100644 --- a/core/modules/system/theme.api.php +++ b/core/modules/system/theme.api.php @@ -186,7 +186,13 @@ function hook_process(&$variables, $hook) { 'variable_name' => $variable_name, 'variables' => $variables, ); - $variables[$variable_name] = theme('rdf_template_variable_wrapper', array('content' => $variables[$variable_name], 'attributes' => $attributes, 'context' => $context)); + $rdf_template_variable_wrapper = array( + '#theme' => 'rdf_template_variable_wrapper', + '#content' => $variables[$variable_name], + '#attributes' => $attributes, + '#context' => $context, + ); + $variables[$variable_name] = drupal_render($rdf_template_variable_wrapper); } } }