Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
294
Merge Requests
294
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
488116d7
Commit
488116d7
authored
Nov 14, 2014
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2352155
by Wim Leers: Remove HtmlFragment/HtmlPage.
parent
9f035188
Changes
80
Hide whitespace changes
Inline
Side-by-side
Showing
80 changed files
with
1617 additions
and
2417 deletions
+1617
-2417
core/authorize.php
core/authorize.php
+1
-2
core/core.services.yml
core/core.services.yml
+32
-24
core/includes/batch.inc
core/includes/batch.inc
+1
-2
core/includes/common.inc
core/includes/common.inc
+0
-141
core/includes/errors.inc
core/includes/errors.inc
+1
-2
core/includes/install.core.inc
core/includes/install.core.inc
+1
-2
core/includes/menu.inc
core/includes/menu.inc
+6
-4
core/includes/theme.inc
core/includes/theme.inc
+45
-59
core/lib/Drupal/Core/Controller/DialogController.php
core/lib/Drupal/Core/Controller/DialogController.php
+0
-157
core/lib/Drupal/Core/Controller/HtmlControllerBase.php
core/lib/Drupal/Core/Controller/HtmlControllerBase.php
+0
-82
core/lib/Drupal/Core/Controller/HtmlPageController.php
core/lib/Drupal/Core/Controller/HtmlPageController.php
+0
-81
core/lib/Drupal/Core/CoreServiceProvider.php
core/lib/Drupal/Core/CoreServiceProvider.php
+3
-0
core/lib/Drupal/Core/Display/Annotation/DisplayVariant.php
core/lib/Drupal/Core/Display/Annotation/DisplayVariant.php
+3
-2
core/lib/Drupal/Core/EventSubscriber/ContentControllerSubscriber.php
...upal/Core/EventSubscriber/ContentControllerSubscriber.php
+17
-20
core/lib/Drupal/Core/EventSubscriber/ContentFormControllerSubscriber.php
.../Core/EventSubscriber/ContentFormControllerSubscriber.php
+3
-1
core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php
...rupal/Core/EventSubscriber/DefaultExceptionSubscriber.php
+13
-60
core/lib/Drupal/Core/EventSubscriber/HtmlViewSubscriber.php
core/lib/Drupal/Core/EventSubscriber/HtmlViewSubscriber.php
+0
-110
core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php
...Drupal/Core/EventSubscriber/MainContentViewSubscriber.php
+107
-0
core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
...Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
+14
-7
core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
+1
-39
core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
+0
-155
core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php
core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php
+0
-125
core/lib/Drupal/Core/Page/FeedLinkElement.php
core/lib/Drupal/Core/Page/FeedLinkElement.php
+0
-32
core/lib/Drupal/Core/Page/HeadElement.php
core/lib/Drupal/Core/Page/HeadElement.php
+0
-100
core/lib/Drupal/Core/Page/HtmlFragment.php
core/lib/Drupal/Core/Page/HtmlFragment.php
+0
-229
core/lib/Drupal/Core/Page/HtmlFragmentInterface.php
core/lib/Drupal/Core/Page/HtmlFragmentInterface.php
+0
-66
core/lib/Drupal/Core/Page/HtmlFragmentRendererInterface.php
core/lib/Drupal/Core/Page/HtmlFragmentRendererInterface.php
+0
-38
core/lib/Drupal/Core/Page/HtmlPage.php
core/lib/Drupal/Core/Page/HtmlPage.php
+0
-234
core/lib/Drupal/Core/Page/HtmlPageRendererInterface.php
core/lib/Drupal/Core/Page/HtmlPageRendererInterface.php
+0
-29
core/lib/Drupal/Core/Page/LinkElement.php
core/lib/Drupal/Core/Page/LinkElement.php
+0
-40
core/lib/Drupal/Core/Page/MetaElement.php
core/lib/Drupal/Core/Page/MetaElement.php
+0
-81
core/lib/Drupal/Core/Page/RenderHtmlRenderer.php
core/lib/Drupal/Core/Page/RenderHtmlRenderer.php
+0
-88
core/lib/Drupal/Core/Page/RenderHtmlRendererInterface.php
core/lib/Drupal/Core/Page/RenderHtmlRendererInterface.php
+0
-31
core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
+80
-0
core/lib/Drupal/Core/Render/BareHtmlPageRendererInterface.php
.../lib/Drupal/Core/Render/BareHtmlPageRendererInterface.php
+79
-0
core/lib/Drupal/Core/Render/Element/Html.php
core/lib/Drupal/Core/Render/Element/Html.php
+1
-1
core/lib/Drupal/Core/Render/Element/Page.php
core/lib/Drupal/Core/Render/Element/Page.php
+3
-1
core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php
core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php
+92
-0
core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php
core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php
+92
-0
core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
+303
-0
core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php
.../Core/Render/MainContent/MainContentRendererInterface.php
+38
-0
core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php
...upal/Core/Render/MainContent/MainContentRenderersPass.php
+33
-0
core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
+42
-0
core/lib/Drupal/Core/Render/PageDisplayVariantSelectionEvent.php
...b/Drupal/Core/Render/PageDisplayVariantSelectionEvent.php
+77
-0
core/lib/Drupal/Core/Render/Plugin/DisplayVariant/SimplePageVariant.php
...l/Core/Render/Plugin/DisplayVariant/SimplePageVariant.php
+47
-0
core/lib/Drupal/Core/Render/RenderEvents.php
core/lib/Drupal/Core/Render/RenderEvents.php
+22
-0
core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php
...ules/basic_auth/src/Authentication/Provider/BasicAuth.php
+1
-1
core/modules/block/block.module
core/modules/block/block.module
+7
-29
core/modules/block/block.services.yml
core/modules/block/block.services.yml
+4
-0
core/modules/block/src/Controller/BlockController.php
core/modules/block/src/Controller/BlockController.php
+30
-4
core/modules/block/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php
...src/EventSubscriber/BlockPageDisplayVariantSubscriber.php
+40
-0
core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php
...ules/block/src/Plugin/DisplayVariant/BlockPageVariant.php
+6
-6
core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
...s/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
+5
-5
core/modules/node/src/Tests/Views/FrontPageTest.php
core/modules/node/src/Tests/Views/FrontPageTest.php
+1
-1
core/modules/rest/src/Tests/ReadTest.php
core/modules/rest/src/Tests/ReadTest.php
+6
-2
core/modules/rest/src/Tests/ResourceTest.php
core/modules/rest/src/Tests/ResourceTest.php
+10
-2
core/modules/simpletest/simpletest.module
core/modules/simpletest/simpletest.module
+0
-1
core/modules/system/src/Controller/BatchController.php
core/modules/system/src/Controller/BatchController.php
+8
-84
core/modules/system/src/Controller/DbUpdateController.php
core/modules/system/src/Controller/DbUpdateController.php
+15
-4
core/modules/system/src/Tests/Common/AddFeedTest.php
core/modules/system/src/Tests/Common/AddFeedTest.php
+6
-12
core/modules/system/src/Tests/Common/PageRenderTest.php
core/modules/system/src/Tests/Common/PageRenderTest.php
+6
-3
core/modules/system/src/Tests/System/MainContentFallbackTest.php
...dules/system/src/Tests/System/MainContentFallbackTest.php
+7
-14
core/modules/system/system.module
core/modules/system/system.module
+80
-0
core/modules/system/system.routing.yml
core/modules/system/system.routing.yml
+2
-2
core/modules/system/templates/html.html.twig
core/modules/system/templates/html.html.twig
+5
-5
core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php
...m/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php
+1
-1
core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestForm.php
.../system/tests/modules/ajax_test/src/Form/AjaxTestForm.php
+1
-1
core/modules/system/tests/modules/system_module_test/src/EventSubscriber/HtmlPageSubscriber.php
...em_module_test/src/EventSubscriber/HtmlPageSubscriber.php
+0
-45
core/modules/system/tests/modules/system_module_test/system_module_test.module
...ests/modules/system_module_test/system_module_test.module
+13
-0
core/modules/system/tests/modules/system_module_test/system_module_test.services.yml
...odules/system_module_test/system_module_test.services.yml
+0
-5
core/modules/system/tests/modules/system_test/system_test.module
...dules/system/tests/modules/system_test/system_test.module
+0
-13
core/modules/system/theme.api.php
core/modules/system/theme.api.php
+74
-0
core/modules/views/views.module
core/modules/views/views.module
+9
-15
core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php
core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php
+84
-0
core/tests/Drupal/Tests/Core/Page/HtmlPageTest.php
core/tests/Drupal/Tests/Core/Page/HtmlPageTest.php
+0
-62
core/themes/bartik/bartik.libraries.yml
core/themes/bartik/bartik.libraries.yml
+1
-0
core/themes/bartik/bartik.theme
core/themes/bartik/bartik.theme
+16
-18
core/themes/seven/css/theme/install-page.css
core/themes/seven/css/theme/install-page.css
+1
-1
core/themes/seven/css/theme/maintenance-page.css
core/themes/seven/css/theme/maintenance-page.css
+1
-1
core/themes/seven/seven.theme
core/themes/seven/seven.theme
+20
-35
No files found.
core/authorize.php
View file @
488116d7
...
...
@@ -25,7 +25,6 @@
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Drupal\Core\Site\Settings
;
use
Drupal\Core\Page\DefaultHtmlPageRenderer
;
// Change the directory to the Drupal root.
chdir
(
'..'
);
...
...
@@ -150,7 +149,7 @@ function authorize_access_allowed() {
if
(
!
empty
(
$output
))
{
$response
->
headers
->
set
(
'Content-Type'
,
'text/html; charset=utf-8'
);
$response
->
setContent
(
DefaultHtmlPageRenderer
::
renderPage
(
$output
,
$page_title
,
'maintenance'
,
array
(
$response
->
setContent
(
\
Drupal
::
service
(
'bare_html_page_renderer'
)
->
renderMaintenancePage
(
$output
,
$page_title
,
array
(
'#show_messages'
=>
$show_messages
,
)));
$response
->
send
();
...
...
core/core.services.yml
View file @
488116d7
...
...
@@ -650,15 +650,34 @@ services:
class
:
Drupal\Core\EventSubscriber\RouteMethodSubscriber
tags
:
-
{
name
:
event_subscriber
}
controller.page
:
class
:
Drupal\Core\Controller\HtmlPageController
arguments
:
[
'
@controller_resolver'
,
'
@title_resolver'
,
'
@render_html_renderer'
]
controller.ajax
:
class
:
Drupal\Core\Controller\AjaxController
arguments
:
[
'
@controller_resolver'
,
'
@element_info'
]
controller.dialog
:
class
:
Drupal\Core\Controller\DialogController
arguments
:
[
'
@controller_resolver'
,
'
@title_resolver'
]
# Main content view subscriber plus the renderers it uses.
main_content_view_subscriber
:
class
:
Drupal\Core\EventSubscriber\MainContentViewSubscriber
arguments
:
[
'
@class_resolver'
,
'
@current_route_match'
,
'
%main_content_renderers%'
]
tags
:
-
{
name
:
event_subscriber
}
main_content_renderer.html
:
class
:
Drupal\Core\Render\MainContent\HtmlRenderer
arguments
:
[
'
@title_resolver'
,
'
@plugin.manager.display_variant'
,
'
@event_dispatcher'
,
'
@module_handler'
]
tags
:
-
{
name
:
render.main_content_renderer
,
format
:
html
}
main_content_renderer.ajax
:
class
:
Drupal\Core\Render\MainContent\AjaxRenderer
arguments
:
[
'
@element_info'
]
tags
:
-
{
name
:
render.main_content_renderer
,
format
:
drupal_ajax
}
main_content_renderer.dialog
:
class
:
Drupal\Core\Render\MainContent\DialogRenderer
arguments
:
[
'
@title_resolver'
]
tags
:
-
{
name
:
render.main_content_renderer
,
format
:
drupal_dialog
}
main_content_renderer.modal
:
class
:
Drupal\Core\Render\MainContent\ModalRenderer
arguments
:
[
'
@title_resolver'
]
tags
:
-
{
name
:
render.main_content_renderer
,
format
:
drupal_modal
}
router_listener
:
class
:
Symfony\Component\HttpKernel\EventListener\RouterListener
tags
:
...
...
@@ -671,19 +690,8 @@ services:
tags
:
-
{
name
:
event_subscriber
}
arguments
:
[
'
@content_negotiation'
,
'
@title_resolver'
]
html_view_subscriber
:
class
:
Drupal\Core\EventSubscriber\HtmlViewSubscriber
tags
:
-
{
name
:
event_subscriber
}
arguments
:
[
'
@html_fragment_renderer'
,
'
@html_page_renderer'
]
render_html_renderer
:
class
:
Drupal\Core\Page\RenderHtmlRenderer
arguments
:
[
'
@url_generator'
]
html_fragment_renderer
:
class
:
Drupal\Core\Page\DefaultHtmlFragmentRenderer
arguments
:
[
'
@language_manager'
]
html_page_renderer
:
class
:
Drupal\Core\Page\DefaultHtmlPageRenderer
bare_html_page_renderer
:
class
:
Drupal\Core\Render\BareHtmlPageRenderer
private_key
:
class
:
Drupal\Core\PrivateKey
arguments
:
[
'
@state'
]
...
...
@@ -732,7 +740,7 @@ services:
arguments
:
[
'
@state'
,
'
@current_user'
]
maintenance_mode_subscriber
:
class
:
Drupal\Core\EventSubscriber\MaintenanceModeSubscriber
arguments
:
[
'
@maintenance_mode'
,
'
@config.factory'
,
'
@string_translation'
,
'
@url_generator'
,
'
@current_user'
]
arguments
:
[
'
@maintenance_mode'
,
'
@config.factory'
,
'
@string_translation'
,
'
@url_generator'
,
'
@current_user'
,
'
@bare_html_page_renderer'
]
tags
:
-
{
name
:
event_subscriber
}
path_subscriber
:
...
...
@@ -777,7 +785,7 @@ services:
class
:
Drupal\Core\EventSubscriber\DefaultExceptionSubscriber
tags
:
-
{
name
:
event_subscriber
}
arguments
:
[
'
@
html_fragment_renderer'
,
'
@html_page_renderer'
,
'
@config.factory
'
]
arguments
:
[
'
@
config.factory'
,
'
@bare_html_page_renderer
'
]
exception.logger
:
class
:
Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber
tags
:
...
...
core/includes/batch.inc
View file @
488116d7
...
...
@@ -19,7 +19,6 @@
use
Drupal\Component\Utility\UrlHelper
;
use
Drupal\Core\Batch\Percentage
;
use
Drupal\Core\Form\FormState
;
use
Drupal\Core\Page\DefaultHtmlPageRenderer
;
use
Drupal\Core\Url
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpFoundation\Request
;
...
...
@@ -136,7 +135,7 @@ function _batch_progress_page() {
// additional HTML output by PHP shows up inside the page rather than below
// it. While this causes invalid HTML, the same would be true if we didn't,
// as content is not allowed to appear after </html> anyway.
$fallback
=
DefaultHtmlPageRenderer
::
renderPage
(
$fallback
,
$current_set
[
'title'
],
'maintenance'
,
array
(
$fallback
=
\
Drupal
::
service
(
'bare_html_page_renderer'
)
->
renderMaintenancePage
(
$fallback
,
$current_set
[
'title'
]
,
array
(
'#show_messages'
=>
FALSE
,
));
list
(
$fallback
)
=
explode
(
'<!--partial-->'
,
$fallback
);
...
...
core/includes/common.inc
View file @
488116d7
...
...
@@ -1117,9 +1117,6 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE, $theme_add_css = TRUE)
'#type'
=>
'styles'
,
'#items'
=>
$css
,
);
if
(
!
empty
(
$setting
))
{
$styles
[
'#attached'
][
'js'
][]
=
array
(
'type'
=>
'setting'
,
'data'
=>
$setting
);
}
return
drupal_render
(
$styles
);
}
...
...
@@ -2261,39 +2258,6 @@ function drupal_page_set_cache(Response $response, Request $request) {
\
Drupal
::
cache
(
'render'
)
->
set
(
$cid
,
$response
,
$expire
,
$tags
);
}
/**
* Sets the main page content value for later use.
*
* Given the nature of the Drupal page handling, this will be called once with
* a string or array. We store that and return it later as the block is being
* displayed.
*
* @param $content
* A string or renderable array representing the body of the page.
*
* @return
* If called without $content, a renderable array representing the body of
* the page.
*/
function
drupal_set_page_content
(
$content
=
NULL
)
{
$content_block
=
&
drupal_static
(
__FUNCTION__
,
NULL
);
$main_content_display
=
&
drupal_static
(
'system_main_content_added'
,
FALSE
);
// Filter out each empty value, though allow '0' and 0, which would be
// filtered out by empty().
if
(
$content
!==
NULL
&&
$content
!==
''
)
{
$content_block
=
(
is_array
(
$content
)
?
$content
:
array
(
'main'
=>
array
(
'#markup'
=>
$content
)));
}
else
{
// Indicate that the main content has been requested. We assume that
// the module requesting the content will be adding it to the page.
// A module can indicate that it does not handle the content by setting
// the static variable back to FALSE after calling this function.
$main_content_display
=
TRUE
;
return
$content_block
;
}
}
/**
* Pre-render callback: Renders a link into #markup.
*
...
...
@@ -2398,111 +2362,6 @@ function drupal_pre_render_links($element) {
return
$element
;
}
/**
* Processes the page render array, enhancing it as necessary.
*
* @param $page
* A string or array representing the content of a page. The array consists of
* the following keys:
* - #type: Value is always 'page'. This pushes the theming through
* the page template (required).
* - #show_messages: Suppress drupal_get_message() items. Used by Batch
* API (optional).
*
* @return array
* The processed render array for the page.
*
* @see hook_page_attachments()
* @see hook_page_attachments_alter()
* @see hook_page_top()
* @see hook_page_bottom()
* @see element_info()
*/
function
drupal_prepare_page
(
$page
)
{
$main_content_display
=
&
drupal_static
(
'system_main_content_added'
,
FALSE
);
// Pull out the page title to set it back later.
if
(
is_array
(
$page
)
&&
isset
(
$page
[
'#title'
]))
{
$title
=
$page
[
'#title'
];
}
// Allow menu callbacks to return strings or arbitrary arrays to render.
// If the array returned is not of #type page directly, we need to fill
// in the page with defaults.
if
(
is_string
(
$page
)
||
(
is_array
(
$page
)
&&
(
!
isset
(
$page
[
'#type'
])
||
(
$page
[
'#type'
]
!=
'page'
))))
{
drupal_set_page_content
(
$page
);
$page
=
element_info
(
'page'
);
}
// Modules can add attachments.
$attachments
=
[];
foreach
(
\
Drupal
::
moduleHandler
()
->
getImplementations
(
'page_attachments'
)
as
$module
)
{
$function
=
$module
.
'_page_attachments'
;
$function
(
$attachments
);
}
if
(
array_diff
(
array_keys
(
$attachments
),
[
'#attached'
,
'#post_render_cache'
])
!==
[])
{
throw
new
\
LogicException
(
'Only #attached and #post_render_cache may be set in hook_page_attachments().'
);
}
// Modules and themes can alter page attachments.
\
Drupal
::
moduleHandler
()
->
alter
(
'page_attachments'
,
$attachments
);
\
Drupal
::
theme
()
->
alter
(
'page_attachments'
,
$attachments
);
if
(
array_diff
(
array_keys
(
$attachments
),
[
'#attached'
,
'#post_render_cache'
])
!==
[])
{
throw
new
\
LogicException
(
'Only #attached and #post_render_cache may be set in hook_page_attachments_alter().'
);
}
if
(
isset
(
$attachments
[
'#attached'
]))
{
$page
[
'#attached'
]
=
$attachments
[
'#attached'
];
}
if
(
isset
(
$attachments
[
'#post_render_cache'
]))
{
$page
[
'#post_render_cache'
]
=
$attachments
[
'#post_render_cache'
];
}
// Modules can add renderable arrays to the top and bottom of the page.
$pseudo_page_top
=
[];
$pseudo_page_bottom
=
[];
foreach
(
\
Drupal
::
moduleHandler
()
->
getImplementations
(
'page_top'
)
as
$module
)
{
$function
=
$module
.
'_page_top'
;
$function
(
$pseudo_page_top
);
}
foreach
(
\
Drupal
::
moduleHandler
()
->
getImplementations
(
'page_bottom'
)
as
$module
)
{
$function
=
$module
.
'_page_bottom'
;
$function
(
$pseudo_page_bottom
);
}
if
(
!
empty
(
$pseudo_page_top
))
{
$page
[
'page_top'
]
=
$pseudo_page_top
;
}
if
(
!
empty
(
$pseudo_page_bottom
))
{
$page
[
'page_bottom'
]
=
$pseudo_page_bottom
;
}
// @todo Clean this up as part of https://www.drupal.org/node/2352155.
if
(
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'block'
))
{
_block_page_build
(
$page
);
// Find all non-empty page regions, and add a theme wrapper function that
// allows them to be consistently themed.
$regions
=
system_region_list
(
\
Drupal
::
theme
()
->
getActiveTheme
()
->
getName
());
foreach
(
array_keys
(
$regions
)
as
$region
)
{
if
(
!
empty
(
$page
[
$region
]))
{
$page
[
$region
][
'#theme_wrappers'
][]
=
'region'
;
$page
[
$region
][
'#region'
]
=
$region
;
}
}
}
// If no module has taken care of the main content, add it to the page now.
// This allows the site to still be usable even if no modules that
// control page regions (for example, the Block module) are enabled.
if
(
!
$main_content_display
)
{
$page
[
'content'
][
'system_main'
]
=
drupal_set_page_content
();
}
// Set back the previously stored title.
if
(
isset
(
$title
))
{
$page
[
'#title'
]
=
$title
;
}
return
$page
;
}
/**
* Renders final HTML given a structured array tree.
*
...
...
core/includes/errors.inc
View file @
488116d7
...
...
@@ -8,7 +8,6 @@
use
Drupal\Component\Utility\SafeMarkup
;
use
Drupal\Component\Utility\Xss
;
use
Drupal\Core\Logger\RfcLogLevel
;
use
Drupal\Core\Page\DefaultHtmlPageRenderer
;
use
Drupal\Core\Utility\Error
;
use
Symfony\Component\HttpFoundation\Response
;
...
...
@@ -236,7 +235,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
install_display_output
(
$output
,
$GLOBALS
[
'install_state'
]);
}
else
{
$output
=
DefaultHtmlPageRenderer
::
render
Page
(
$message
,
'Error'
);
$output
=
\
Drupal
::
service
(
'bare_html_page_renderer'
)
->
renderMaintenance
Page
(
$message
,
'Error'
);
}
$response
=
new
Response
(
$output
,
500
);
...
...
core/includes/install.core.inc
View file @
488116d7
...
...
@@ -14,7 +14,6 @@
use
Drupal\Core\Installer\InstallerKernel
;
use
Drupal\Core\Language\Language
;
use
Drupal\Core\Language\LanguageManager
;
use
Drupal\Core\Page\DefaultHtmlPageRenderer
;
use
Drupal\Core\Site\Settings
;
use
Drupal\Core\StringTranslation\Translator\FileTranslation
;
use
Drupal\Core\Extension\ExtensionDiscovery
;
...
...
@@ -934,7 +933,7 @@ function install_display_output($output, $install_state) {
'ETag'
=>
'"'
.
REQUEST_TIME
.
'"'
,
);
$response
->
headers
->
add
(
$default_headers
);
$response
->
setContent
(
DefaultHtmlPageRenderer
::
renderPage
(
$output
,
$output
[
'#title'
],
'install'
,
$regions
));
$response
->
setContent
(
\
Drupal
::
service
(
'bare_html_page_renderer'
)
->
renderInstallPage
(
$output
,
$output
[
'#title'
]
,
$regions
));
$response
->
send
();
exit
;
}
...
...
core/includes/menu.inc
View file @
488116d7
...
...
@@ -110,13 +110,15 @@
* class and method. Page controller classes do not necessarily need to
* implement any particular interface or extend any particular base class. The
* only requirement is that the method specified in your *.routing.yml file
* return one of the following, depending on whether you specified _content or
* _controller in the routing file defaults section:
* returns:
* - A render array (see the
* @link theme_render Theme and render topic @endlink for more information),
* if _content is used in the routing file.
* - A \Drupal\Core\Page\HtmlFragmentInterface object (fragment or page), if
* _content is used in the routing file.
* This render array is then rendered in the requested format (HTML, dialog,
* modal, AJAX are supported by default). In the case of HTML, it will be
* surrounded by blocks by default: the Block module is enabled by default,
* and hence its Page Display Variant that surrounds the main content with
* blocks is also used by default.
* - A \Symfony\Component\HttpFoundation\Response object, if _controller is
* used in the routing file.
* As a note, if your module registers multiple simple routes, it is usual
...
...
core/includes/theme.inc
View file @
488116d7
...
...
@@ -18,8 +18,6 @@
use
Drupal\Core\Config\StorageException
;
use
Drupal\Core\Extension\Extension
;
use
Drupal\Core\Extension\ExtensionNameLengthException
;
use
Drupal\Core\Page\LinkElement
;
use
Drupal\Core\Page\MetaElement
;
use
Drupal\Core\Template\Attribute
;
use
Drupal\Core\Theme\ThemeSettings
;
use
Drupal\Component\Utility\NestedArray
;
...
...
@@ -1646,22 +1644,37 @@ function drupal_pre_render_html(array $element) {
* - page: A render element representing the page.
*/
function
template_preprocess_html
(
&
$variables
)
{
/** @var $page \Drupal\Core\Page\HtmlPage */
$page
=
$variables
[
'page_object'
];
$variables
[
'page'
]
=
$variables
[
'html'
][
'page'
];
unset
(
$variables
[
'html'
][
'page'
]);
$variables
[
'page_top'
]
=
NULL
;
if
(
isset
(
$variables
[
'html'
][
'page_top'
]))
{
$variables
[
'page_top'
]
=
$variables
[
'html'
][
'page_top'
];
unset
(
$variables
[
'html'
][
'page_top'
]);
}
$variables
[
'page_bottom'
]
=
NULL
;
if
(
isset
(
$variables
[
'html'
][
'page_bottom'
]))
{
$variables
[
'page_bottom'
]
=
$variables
[
'html'
][
'page_bottom'
];
unset
(
$variables
[
'html'
][
'page_bottom'
]);
}
$variables
[
'html_attributes'
]
=
$page
->
getHtmlAttributes
();
$variables
[
'attributes'
]
=
$page
->
getBodyAttributes
();
$variables
[
'page'
]
=
$page
;
$variables
[
'html_attributes'
]
=
new
Attribute
();
// HTML element attributes.
$language_interface
=
\
Drupal
::
languageManager
()
->
getCurrentLanguage
();
$variables
[
'html_attributes'
][
'lang'
]
=
$language_interface
->
getId
();
$variables
[
'html_attributes'
][
'dir'
]
=
$language_interface
->
getDirection
();
// Compile a list of classes that are going to be applied to the body element.
// This allows advanced theming based on context (home page, node of certain
// type, etc.).
$body_classes
=
$variables
[
'attributes'
][
'class'
];
if
(
isset
(
$variables
[
'db_is_active'
])
&&
!
$variables
[
'db_is_active'
])
{
$variables
[
'attributes'
][
'class'
][]
=
'db-offline'
;
}
// Add a class that tells us whether the page is viewed by an authenticated
// user.
if
(
$variables
[
'logged_in'
])
{
$
body_classes
[]
=
'user-logged-in'
;
$
variables
[
'attributes'
][
'class'
]
[]
=
'user-logged-in'
;
}
// Add a class that tells us what path the page is located make it possible
// to theme the page depending on the current path (e.g. node, admin, user,
...
...
@@ -1669,20 +1682,18 @@ function template_preprocess_html(&$variables) {
$path
=
\
Drupal
::
request
()
->
getPathInfo
();
if
(
drupal_is_front_page
())
{
$
body_classes
[]
=
'path-frontpage'
;
$
variables
[
'attributes'
][
'class'
]
[]
=
'path-frontpage'
;
}
else
{
$segment
=
explode
(
'/'
,
$path
);
$
body_classes
[]
=
'path-'
.
drupal_html_class
(
$segment
[
1
]);
$
variables
[
'attributes'
][
'class'
]
[]
=
'path-'
.
drupal_html_class
(
$segment
[
1
]);
}
$variables
[
'attributes'
][
'class'
]
=
$body_classes
;
$site_config
=
\
Drupal
::
config
(
'system.site'
);
// Construct page title.
if
(
$page
->
hasTitle
(
))
{
if
(
!
empty
(
$variables
[
'page'
][
'#title'
]
))
{
$head_title
=
array
(
'title'
=>
SafeMarkup
::
set
(
trim
(
strip_tags
(
$
page
->
getTitle
()
))),
'title'
=>
SafeMarkup
::
set
(
trim
(
strip_tags
(
$
variables
[
'page'
][
'#title'
]
))),
'name'
=>
String
::
checkPlain
(
$site_config
->
get
(
'name'
)),
);
}
...
...
@@ -1710,35 +1721,27 @@ function template_preprocess_html(&$variables) {
}
$variables
[
'head_title'
]
=
SafeMarkup
::
set
(
$output
);
// @todo Remove drupal_*_html_head() and refactor accordingly.
$html_heads
=
drupal_get_html_head
(
FALSE
);
uasort
(
$html_heads
,
'Drupal\Component\Utility\SortArray::sortByWeightElement'
);
foreach
(
$html_heads
as
$name
=>
$tag
)
{
if
(
$tag
[
'#tag'
]
==
'link'
)
{
$link
=
new
LinkElement
(
$name
,
isset
(
$tag
[
'#attributes'
][
'content'
])
?
$tag
[
'#attributes'
][
'content'
]
:
NULL
,
$tag
[
'#attributes'
]);
if
(
!
empty
(
$tag
[
'#noscript'
]))
{
$link
->
setNoScript
();
}
$page
->
addLinkElement
(
$link
);
}
elseif
(
$tag
[
'#tag'
]
==
'meta'
)
{
$metatag
=
new
MetaElement
(
NULL
,
$tag
[
'#attributes'
]);
if
(
!
empty
(
$tag
[
'#noscript'
]))
{
$metatag
->
setNoScript
();
}
$page
->
addMetaElement
(
$metatag
);
}
// Collect all attachments. This must happen in the preprocess function for
// #type => html, to ensure that attachments added in #pre_render callbacks
// for #type => html are included.
$attached
=
$variables
[
'html'
][
'#attached'
];
$attached
=
drupal_merge_attached
(
$attached
,
$variables
[
'page'
][
'#attached'
]);
if
(
isset
(
$variables
[
'page_top'
]))
{
$attached
=
drupal_merge_attached
(
$attached
,
$variables
[
'page_top'
][
'#attached'
]);
}
// Add favicon.
if
(
theme_get_setting
(
'features.favicon'
))
{
$url
=
UrlHelper
::
stripDangerousProtocols
(
theme_get_setting
(
'favicon.url'
));
$link
=
new
LinkElement
(
$url
,
'shortcut icon'
,
[
'type'
=>
theme_get_setting
(
'favicon.mimetype'
)]);
$page
->
addLinkElement
(
$link
);
if
(
isset
(
$variables
[
'page_bottom'
]))
{
$attached
=
drupal_merge_attached
(
$attached
,
$variables
[
'page_bottom'
][
'#attached'
]);
}
$variables
[
'page_top'
][]
=
array
(
'#markup'
=>
$page
->
getBodyTop
());
$variables
[
'page_bottom'
][]
=
array
(
'#markup'
=>
$page
->
getBodyBottom
());
// Render the attachments into HTML markup to be used directly in the template
// for #type => html: html.html.twig.
$all_attached
=
[
'#attached'
=>
$attached
];
drupal_process_attached
(
$all_attached
);
$variables
[
'styles'
]
=
drupal_get_css
();
$variables
[
'scripts'
]
=
drupal_get_js
();
$variables
[
'scripts_bottom'
]
=
drupal_get_js
(
'footer'
);
$variables
[
'head'
]
=
drupal_get_html_head
(
FALSE
);
}
/**
...
...
@@ -1749,8 +1752,6 @@ function template_preprocess_html(&$variables) {
* Most themes use their own copy of page.html.twig. The default is located
* inside "modules/system/page.html.twig". Look in there for the full list of
* variables.
*
* @see DefaultHtmlFragmentRenderer::render()
*/
function
template_preprocess_page
(
&
$variables
)
{
$language_interface
=
\
Drupal
::
languageManager
()
->
getCurrentLanguage
();
...
...
@@ -1890,15 +1891,6 @@ function template_preprocess_maintenance_page(&$variables) {
// @todo Rename the templates to page--maintenance + page--install.
template_preprocess_page
(
$variables
);
$page_object
=
$variables
[
'page'
][
'#page'
];
$attributes
=
$page_object
->
getBodyAttributes
();
$classes
=
$attributes
[
'class'
];
$classes
[]
=
'maintenance-page'
;
if
(
isset
(
$variables
[
'db_is_active'
])
&&
!
$variables
[
'db_is_active'
])
{
$classes
[]
=
'db-offline'
;
}
$attributes
[
'class'
]
=
$classes
;
// @see system_page_attachments()
$variables
[
'#attached'
][
'library'
][]
=
'core/normalize'
;
$variables
[
'#attached'
][
'library'
][]
=
'system/maintenance'
;
...
...
@@ -1918,12 +1910,6 @@ function template_preprocess_maintenance_page(&$variables) {
function
template_preprocess_install_page
(
&
$variables
)
{
template_preprocess_maintenance_page
(
$variables
);
$page_object
=
$variables
[
'page'
][
'#page'
];
$attributes
=
$page_object
->
getBodyAttributes
();
$classes
=
$attributes
[
'class'
];
$classes
[]
=
'install-page'
;
$attributes
[
'class'
]
=
$classes
;
// Override the site name that is displayed on the page, since Drupal is
// still in the process of being installed.
$distribution_name
=
String
::
checkPlain
(
drupal_install_profile_distribution_name
());
...
...
@@ -2161,7 +2147,7 @@ function drupal_common_theme() {
return
array
(
// From theme.inc.
'html'
=>
array
(
'
variables'
=>
array
(
'page_object'
=>
NULL
)
,
'
render element'
=>
'html'
,
),
'page'
=>
array
(
'render element'
=>
'page'
,
...
...
core/lib/Drupal/Core/Controller/DialogController.php
deleted
100644 → 0
View file @
9f035188
<?php
/**
* @file
* Contains \Drupal\Core\Controller\DialogController.
*/
namespace
Drupal\Core\Controller
;
use
Drupal\Core\Ajax\AjaxResponse
;
use
Drupal\Core\Ajax\OpenDialogCommand
;
use
Drupal\Core\Page\HtmlPage
;
use
Drupal\Core\Routing\RouteMatchInterface
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
/**
* Defines a default controller for dialog requests.
*/
class
DialogController
{
/**
* The controller resolver service.
*
* @var \Drupal\Core\Controller\ControllerResolverInterface
*/
protected
$controllerResolver
;
/**
* The title resolver.
*
* @var \Drupal\Core\Controller\TitleResolver
*/
protected
$titleResolver
;
/**
* Constructs a new DialogController.
*
* @param \Drupal\Core\Controller\ControllerResolverInterface $controller_resolver
* The controller resolver service.
* @param \Drupal\Core\Controller\TitleResolverInterface $title_resolver
* The title resolver.
*/
public
function
__construct
(
ControllerResolverInterface
$controller_resolver
,
TitleResolverInterface
$title_resolver
)
{
$this
->
controllerResolver
=
$controller_resolver
;
$this
->
titleResolver
=
$title_resolver
;
}
/**
* Displays content in a modal dialog.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request object.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param mixed $_content
* A controller definition string, or a callable object/closure.
*
* @return \Drupal\Core\Ajax\AjaxResponse
* AjaxResponse to return the content wrapper in a modal dialog.
*/
public
function
modal
(
Request
$request
,
RouteMatchInterface
$route_match
,
$_content
)
{
return
$this
->
dialog
(
$request
,
$route_match
,
$_content
,
TRUE
);
}
/**
* Displays content in a dialog.
*