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..b5fe6da 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemPoweredByBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemPoweredByBlock.php @@ -26,8 +26,9 @@ class SystemPoweredByBlock extends BlockBase { * {@inheritdoc} */ public function build() { + $system_powered_by = array('#theme' => 'system_powered_by'); return array( - '#children' => theme('system_powered_by'), + '#children' => drupal_render($system_powered_by), ); } 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 072bfb0..8c03477 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -41,19 +41,17 @@ function setUp() { * Render arrays that use a render element and templates (and hence call * template_preprocess()) must ensure the attributes at different occassions * are all merged correctly: - * - $variables['attributes'] as passed in to theme() + * - $variables['attributes'] as passed in to drupal_render() * - the render element's #attributes * - any attributes set in the template's preprocessing function */ function testAttributeMerging() { - $output = theme('theme_test_render_element', array( - 'elements' => array( - '#attributes' => array('data-foo' => 'bar'), - ), - 'attributes' => array( - 'id' => 'bazinga', - ), - )); + $theme_test_render_element = array( + '#theme' => 'theme_test_render_element', + '#elements' => array('#attributes' => array('data-foo' => 'bar')), + '#attributes' => array('id' => 'bazinga'), + ); + $output = drupal_render($theme_test_render_element); $this->assertIdentical($output, '
' . "\n"); } @@ -196,44 +194,47 @@ function testThemeGetSetting() { * Ensures the theme registry is rebuilt when modules are disabled/enabled. */ function testRegistryRebuild() { - $this->assertIdentical(theme('theme_test_foo', array('foo' => 'a')), 'a', 'The theme registry contains theme_test_foo.'); + $theme_test_foo = array( '#theme' => 'theme_test_foo', '#foo' => 'a' ); + $this->assertIdentical(drupal_render($theme_test_foo), 'a', 'The theme registry contains theme_test_foo.'); module_disable(array('theme_test'), FALSE); // After enabling/disabling a module during a test, we need to rebuild the - // container and ensure the extension handler is loaded, otherwise theme() - // throws an exception. + // container and ensure the extension handler is loaded, otherwise + // drupal_render() throws an exception. $this->rebuildContainer(); $this->container->get('module_handler')->loadAll(); - $this->assertIdentical(theme('theme_test_foo', array('foo' => 'b')), FALSE, 'The theme registry does not contain theme_test_foo, because the module is disabled.'); + $theme_test_foo = array('#theme' => 'theme_test_foo', '#foo' => 'b'); + $this->assertIdentical(drupal_render($theme_test_foo), FALSE, 'The theme registry does not contain theme_test_foo, because the module is disabled.'); module_enable(array('theme_test'), FALSE); // After enabling/disabling a module during a test, we need to rebuild the - // container and ensure the extension handler is loaded, otherwise theme() - // throws an exception. + // container and ensure the extension handler is loaded, otherwise + // drupal_render() throws an exception. $this->rebuildContainer(); $this->container->get('module_handler')->loadAll(); - $this->assertIdentical(theme('theme_test_foo', array('foo' => 'c')), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.'); + $theme_test_foo = array('#theme' => 'theme_test_foo', '#foo' => 'c'); + $this->assertIdentical(drupal_render($theme_test_foo), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.'); } /** * Tests child element rendering for 'render element' theme hooks. */ function testDrupalRenderChildren() { - $element = array( + $theme_test_render_element_children = array( '#theme' => 'theme_test_render_element_children', 'child' => array( '#markup' => 'Foo', ), ); - $this->assertIdentical(theme('theme_test_render_element_children', $element), 'Foo', 'drupal_render() avoids #theme recursion loop when rendering a render element.'); + $this->assertIdentical(drupal_render($theme_test_render_element_children), 'Foo', 'drupal_render() avoids #theme recursion loop when rendering a render element.'); - $element = array( + $theme_test_render_element_children = array( '#theme_wrappers' => array('theme_test_render_element_children'), 'child' => array( '#markup' => 'Foo', ), ); - $this->assertIdentical(theme('theme_test_render_element_children', $element), 'Foo', 'drupal_render() avoids #theme_wrappers recursion loop when rendering a render element.'); + $this->assertIdentical(drupal_render($theme_test_render_element_children), 'Foo', 'drupal_render() avoids #theme_wrappers recursion loop when rendering a render element.'); } /** 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..c049dd0 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,7 @@ function testTwigDebugMarkup() { // Create a node and test different features of the debug markup. $node = $this->drupalCreateNode(); - $output = theme('node', node_view($node)); + $output = drupal_render(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, 'x node--1' . $extension) !== FALSE, 'Node ID specific template shown as current template.'); @@ -63,7 +63,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 = drupal_render(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.'); @@ -72,7 +72,7 @@ function testTwigDebugMarkup() { $this->rebuildContainer(); $this->resetAll(); - $output = theme('node', node_view($node)); + $output = drupal_render(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.admin.inc b/core/modules/system/system.admin.inc index 957db86..e72a57f 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -48,8 +48,12 @@ function system_admin_config_page() { unset($item['localized_options']['attributes']['title']); } $block = $item; + $admin_block_content = array( + '#theme' => 'admin_block_content', + '#content' => system_admin_menu_block($item), + ); $block['content'] = ''; - $block['content'] .= theme('admin_block_content', array('content' => system_admin_menu_block($item))); + $block['content'] .= drupal_render($admin_block_content); if (!empty($block['content'])) { $block['show'] = TRUE; } @@ -62,7 +66,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.'); @@ -82,8 +90,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.'); @@ -218,7 +227,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); } /** @@ -614,9 +628,15 @@ function _system_modules_build_row($info, $extra) { } else { $form['enable'] = array( - '#markup' => theme('image', array('uri' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)), + '#theme' => 'image', + '#uri' => 'core/misc/watchdog-error.png', + '#alt' => $status_short, + '#title' => $status_short, + ); + $form['description'] = array( + '#theme' => 'system_modules_incompatible', + '#message' => $status_long, ); - $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long)); } // Build operation links. @@ -983,7 +1003,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'; @@ -995,8 +1019,9 @@ function theme_admin_page($variables) { } } + $system_compact_link = array('#theme' => 'system_compact_link'); $output = '