diff --git a/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php b/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php index a7164d9..f95d992 100644 --- a/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php +++ b/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php @@ -52,7 +52,7 @@ public function renderBarePage(array $content, $title, $page_theme_property, arr '#type' => 'html', '#attributes' => $attributes, 'page' => [ - '#type' => 'page', + '#type' => 'body', '#theme' => $page_theme_property, '#title' => $title, 'content' => $content, diff --git a/core/lib/Drupal/Core/Render/Element/Page.php b/core/lib/Drupal/Core/Render/Element/Body.php similarity index 77% rename from core/lib/Drupal/Core/Render/Element/Page.php rename to core/lib/Drupal/Core/Render/Element/Body.php index b73c808d..46c839a 100644 --- a/core/lib/Drupal/Core/Render/Element/Page.php +++ b/core/lib/Drupal/Core/Render/Element/Body.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Render\Element\Page. + * Contains \Drupal\Core\Render\Element\Body. */ namespace Drupal\Core\Render\Element; @@ -12,9 +12,9 @@ * * This represents the "main part" of the HTML page's body; see html.html.twig. * - * @RenderElement("page") + * @RenderElement("body") */ -class Page extends RenderElement { +class Body extends RenderElement { /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index 7e06aab..440b2b7 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -102,13 +102,13 @@ public function __construct(TitleResolverInterface $title_resolver, PluginManage /** * {@inheritdoc} * - * The entire HTML: takes a #type 'page' and wraps it in a #type 'html'. + * The entire HTML: takes a #type 'body' and wraps it in a #type 'html'. */ public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) { list($page, $title) = $this->prepare($main_content, $request, $route_match); - if (!isset($page['#type']) || $page['#type'] !== 'page') { - throw new \LogicException('Must be #type page'); + if (!isset($page['#type']) || $page['#type'] !== 'body') { + throw new \LogicException('Must be #type body'); } $page['#title'] = $title; @@ -142,7 +142,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch } /** - * Prepares the HTML body: wraps the main content in #type 'page'. + * Prepares the HTML body: wraps the main content in #type 'body'. * * @param array $main_content * The render array representing the main content. @@ -153,20 +153,20 @@ public function renderResponse(array $main_content, Request $request, RouteMatch * * @return array * An array with two values: - * 0. A #type 'page' render array. + * 0. A #type 'body' render array. * 1. The page title. * * @throws \LogicException * If the selected display variant does not implement PageVariantInterface. */ protected function prepare(array $main_content, Request $request, RouteMatchInterface $route_match) { - // If the _controller result already is #type => page, + // If the _controller result already is #type => body, // we have no work to do: The "main content" already is an entire "page" // (see html.html.twig). - if (isset($main_content['#type']) && $main_content['#type'] === 'page') { + if (isset($main_content['#type']) && $main_content['#type'] === 'body') { $page = $main_content; } - // Otherwise, render it as the main content of a #type => page, by selecting + // Otherwise, render it as the main content of a #type => body, by selecting // page display variant to do that and building that page display variant. else { // Select the page display variant to be used to render this main content, @@ -205,10 +205,10 @@ protected function prepare(array $main_content, Request $request, RouteMatchInte ->setMainContent($main_content) ->setConfiguration($event->getPluginConfiguration()); - // Generate a #type => page render array using the page display variant, + // Generate a #type => body render array using the page display variant, // the page display will build the content for the various page regions. $page = array( - '#type' => 'page', + '#type' => 'body', ); $page += $page_display->build(); } @@ -237,7 +237,7 @@ protected function prepare(array $main_content, Request $request, RouteMatchInte * Invokes the page attachment hooks. * * @param array &$page - * A #type 'page' render array, for which the page attachment hooks will be + * A #type 'body' render array, for which the page attachment hooks will be * invoked and to which the results will be added. * * @throws \LogicException diff --git a/core/modules/block/src/Controller/BlockController.php b/core/modules/block/src/Controller/BlockController.php index 66ecbbd..e7ddb2c 100644 --- a/core/modules/block/src/Controller/BlockController.php +++ b/core/modules/block/src/Controller/BlockController.php @@ -51,12 +51,12 @@ public static function create(ContainerInterface $container) { * The name of the theme. * * @return array - * A #type 'page' render array containing the block region demo. + * A #type 'body' render array containing the block region demo. */ public function demo($theme) { $page = [ '#title' => $this->themeHandler->getName($theme), - '#type' => 'page', + '#type' => 'body', '#attached' => array( 'drupalSettings' => [ // The block demonstration page is not marked as an administrative diff --git a/core/modules/system/src/Controller/BatchController.php b/core/modules/system/src/Controller/BatchController.php index 9a0e8f0..64f6645 100644 --- a/core/modules/system/src/Controller/BatchController.php +++ b/core/modules/system/src/Controller/BatchController.php @@ -67,7 +67,7 @@ public function batchPage(Request $request) { } elseif (isset($output)) { $page = [ - '#type' => 'page', + '#type' => 'body', '#show_messages' => FALSE, 'content' => $output, ]; diff --git a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php index 25ef1c5..ea0f796 100644 --- a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php +++ b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php @@ -88,7 +88,7 @@ public function triggerPDOException() { */ public function triggerRendererException() { return [ - '#type' => 'page', + '#type' => 'body', '#post_render' => [ function () { throw new \Exception('This is an exception that occurs during rendering'); diff --git a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php index b0ca1f7..440584b 100644 --- a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php @@ -122,13 +122,13 @@ public function providerTestGetInfo() { $data = array(); // Provide an element and expect it is returned. $data[] = array( - 'page', + 'body', array( - '#type' => 'page', + '#type' => 'body', '#theme' => 'page', '#defaults_loaded' => TRUE, ), - array('page' => array( + array('body' => array( '#theme' => 'page', )), ); @@ -138,24 +138,24 @@ public function providerTestGetInfo() { array( '#defaults_loaded' => TRUE, ), - array('page' => array( + array('body' => array( '#theme' => 'page', )), ); // Provide an element and alter it to ensure it is altered. $data[] = array( - 'page', + 'body', array( - '#type' => 'page', + '#type' => 'body', '#theme' => 'page', '#number' => 597219, '#defaults_loaded' => TRUE, ), - array('page' => array( + array('body' => array( '#theme' => 'page', )), function ($alter_name, array &$info) { - $info['page']['#number'] = 597219; + $info['body']['#number'] = 597219; } ); return $data; @@ -197,15 +197,15 @@ public function testGetInfoElementPlugin($plugin_class, $expected_info) { $element_info->expects($this->once()) ->method('createInstance') - ->with('page') + ->with('body') ->willReturn($plugin); $element_info->expects($this->once()) ->method('getDefinitions') ->willReturn(array( - 'page' => array('class' => 'TestElementPlugin'), + 'body' => array('class' => 'TestElementPlugin'), )); - $this->assertEquals($expected_info, $element_info->getInfo('page')); + $this->assertEquals($expected_info, $element_info->getInfo('body')); } /** @@ -218,7 +218,7 @@ public function providerTestGetInfoElementPlugin() { $data[] = array( 'Drupal\Core\Render\Element\ElementInterface', array( - '#type' => 'page', + '#type' => 'body', '#theme' => 'page', '#defaults_loaded' => TRUE, ), @@ -227,7 +227,7 @@ public function providerTestGetInfoElementPlugin() { $data[] = array( 'Drupal\Core\Render\Element\FormElementInterface', array( - '#type' => 'page', + '#type' => 'body', '#theme' => 'page', '#input' => TRUE, '#value_callback' => array('TestElementPlugin', 'valueCallback'),