Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-2842405
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-2842405
Commits
cd2b53a5
Commit
cd2b53a5
authored
2 months ago
by
Darren Fisher
Browse files
Options
Downloads
Patches
Plain Diff
Fix system.module so 11.x can be merged.
parent
433ce00a
No related branches found
No related tags found
No related merge requests found
Pipeline
#384837
canceled
2 months ago
Stage: 🪄 Lint
Stage: 🗜️ Test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/system/system.module
+4
-223
4 additions, 223 deletions
core/modules/system/system.module
with
4 additions
and
223 deletions
core/modules/system/system.module
+
4
−
223
View file @
cd2b53a5
...
...
@@ -5,23 +5,12 @@
*/
use
Drupal\Component\FileSecurity\FileSecurity
;
use
Drupal\Component\Utility\UrlHelper
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Asset\AttachedAssetsInterface
;
use
Drupal\Core\Block\BlockPluginInterface
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Database\Query\AlterableInterface
;
use
Drupal\Core\Entity\ContentEntityTypeInterface
;
use
Drupal\Core\Extension\Extension
;
use
Drupal\Core\Field\FieldDefinitionInterface
;
use
Drupal\Core\Field\FieldItemListInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory
;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\Core\Link
;
use
Drupal\Core\Queue\QueueGarbageCollectionInterface
;
use
Drupal\Core\Routing\RouteMatchInterface
;
use
Drupal\Core\Routing\StackedRouteMatchInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Site\Settings
;
use
Drupal\Core\StreamWrapper\LocalStream
;
...
...
@@ -59,120 +48,6 @@
*/
const
REGIONS_ALL
=
'all'
;
/**
* Implements hook_theme().
*/
function
system_theme
():
array
{
return
array_merge
(
drupal_common_theme
(),
[
// Normally theme suggestion templates are only picked up when they are in
// themes. We explicitly define theme suggestions here so that the block
// templates in core/modules/system/templates are picked up.
'block__system_branding_block'
=>
[
'render element'
=>
'elements'
,
'base hook'
=>
'block'
,
],
'block__system_messages_block'
=>
[
'base hook'
=>
'block'
,
],
'block__system_menu_block'
=>
[
'render element'
=>
'elements'
,
'base hook'
=>
'block'
,
],
'system_themes_page'
=>
[
'variables'
=>
[
'theme_groups'
=>
[],
'theme_group_titles'
=>
[],
],
'file'
=>
'system.admin.inc'
,
],
'system_config_form'
=>
[
'render element'
=>
'form'
,
],
'confirm_form'
=>
[
'render element'
=>
'form'
,
],
'system_modules_details'
=>
[
'render element'
=>
'form'
,
'file'
=>
'system.admin.inc'
,
],
'system_modules_uninstall'
=>
[
'render element'
=>
'form'
,
'file'
=>
'system.admin.inc'
,
],
'status_report_page'
=>
[
'variables'
=>
[
'counters'
=>
[],
'general_info'
=>
[],
'requirements'
=>
NULL
,
],
],
'status_report'
=>
[
'variables'
=>
[
'grouped_requirements'
=>
NULL
,
'requirements'
=>
NULL
,
],
],
'status_report_grouped'
=>
[
'variables'
=>
[
'grouped_requirements'
=>
NULL
,
'requirements'
=>
NULL
,
],
],
'status_report_counter'
=>
[
'variables'
=>
[
'amount'
=>
NULL
,
'text'
=>
NULL
,
'severity'
=>
NULL
],
],
'status_report_general_info'
=>
[
'variables'
=>
[
'drupal'
=>
[],
'cron'
=>
[],
'database_system'
=>
[],
'database_system_version'
=>
[],
'php'
=>
[],
'php_memory_limit'
=>
[],
'webserver'
=>
[],
],
],
'admin_page'
=>
[
'variables'
=>
[
'blocks'
=>
NULL
],
'file'
=>
'system.admin.inc'
,
],
'admin_block'
=>
[
'variables'
=>
[
'block'
=>
NULL
,
'attributes'
=>
[]],
'file'
=>
'system.admin.inc'
,
],
'admin_block_content'
=>
[
'variables'
=>
[
'content'
=>
NULL
],
'file'
=>
'system.admin.inc'
,
],
'system_admin_index'
=>
[
'variables'
=>
[
'menu_items'
=>
NULL
],
'file'
=>
'system.admin.inc'
,
],
'entity_add_list'
=>
[
'variables'
=>
[
'bundles'
=>
[],
'add_bundle_message'
=>
NULL
,
],
'template'
=>
'entity-add-list'
,
],
'off_canvas_page_wrapper'
=>
[
'variables'
=>
[
'children'
=>
NULL
],
],
'system_security_advisories_fetch_error_message'
=>
[
'file'
=>
'system.theme.inc'
,
'variables'
=>
[
'error_message'
=>
[]],
],
'entity_page_title'
=>
[
'variables'
=>
[
'attributes'
=>
[],
'title'
=>
NULL
,
'entity'
=>
NULL
,
'view_mode'
=>
NULL
,
],
],
]);
}
/**
* Implements hook_hook_info().
*/
...
...
@@ -279,7 +154,7 @@ function system_theme_suggestions_field(array $variables) {
* - add_bundle_message: The message shown when there are no bundles. Only
* available if the entity type uses bundle entities.
*/
function
template_preprocess_entity_add_list
(
&
$variables
)
{
function
template_preprocess_entity_add_list
(
&
$variables
)
:
void
{
foreach
(
$variables
[
'bundles'
]
as
$bundle_name
=>
$bundle_info
)
{
$variables
[
'bundles'
][
$bundle_name
][
'description'
]
=
[
'#markup'
=>
$bundle_info
[
'description'
],
...
...
@@ -435,105 +310,10 @@ function system_authorized_batch_process() {
return
batch_process
(
$finish_url
->
setAbsolute
()
->
toString
(),
$process_url
);
}
/**
* Implements hook_page_attachments().
*
* @see template_preprocess_maintenance_page()
* @see \Drupal\Core\EventSubscriber\ActiveLinkResponseFilter
*/
function
_system_page_attachments
(
array
&
$page
)
{
// Ensure the same CSS is loaded in template_preprocess_maintenance_page().
$page
[
'#attached'
][
'library'
][]
=
'system/base'
;
if
(
\Drupal
::
service
(
'router.admin_context'
)
->
isAdminRoute
())
{
$page
[
'#attached'
][
'library'
][]
=
'system/admin'
;
}
// Attach libraries used by this theme.
$active_theme
=
\Drupal
::
theme
()
->
getActiveTheme
();
foreach
(
$active_theme
->
getLibraries
()
as
$library
)
{
$page
[
'#attached'
][
'library'
][]
=
$library
;
}
// Attach favicon.
if
(
theme_get_setting
(
'features.favicon'
))
{
$favicon
=
theme_get_setting
(
'favicon.url'
);
$type
=
theme_get_setting
(
'favicon.mimetype'
);
$page
[
'#attached'
][
'html_head_link'
][][]
=
[
'rel'
=>
'icon'
,
'href'
=>
UrlHelper
::
stripDangerousProtocols
(
$favicon
),
'type'
=>
$type
,
];
}
// Get the major Drupal version.
[
$version
]
=
explode
(
'.'
,
\Drupal
::
VERSION
);
// Attach default meta tags.
$meta_default
=
[
// Make sure the Content-Type comes first because the IE browser may be
// vulnerable to XSS via encoding attacks from any content that comes
// before this META tag, such as a TITLE tag.
'system_meta_content_type'
=>
[
'#tag'
=>
'meta'
,
'#attributes'
=>
[
'charset'
=>
'utf-8'
,
],
// Security: This always has to be output first.
'#weight'
=>
-
1000
,
],
// Show Drupal and the major version number in the META GENERATOR tag.
'system_meta_generator'
=>
[
'#type'
=>
'html_tag'
,
'#tag'
=>
'meta'
,
'#attributes'
=>
[
'name'
=>
'Generator'
,
'content'
=>
'Drupal '
.
$version
.
' (https://www.drupal.org)'
,
],
],
// Attach default mobile meta tags for responsive design.
'MobileOptimized'
=>
[
'#tag'
=>
'meta'
,
'#attributes'
=>
[
'name'
=>
'MobileOptimized'
,
'content'
=>
'width'
,
],
],
'HandheldFriendly'
=>
[
'#tag'
=>
'meta'
,
'#attributes'
=>
[
'name'
=>
'HandheldFriendly'
,
'content'
=>
'true'
,
],
],
'viewport'
=>
[
'#tag'
=>
'meta'
,
'#attributes'
=>
[
'name'
=>
'viewport'
,
'content'
=>
'width=device-width, initial-scale=1.0'
,
],
],
];
foreach
(
$meta_default
as
$key
=>
$value
)
{
$page
[
'#attached'
][
'html_head'
][]
=
[
$value
,
$key
];
}
// Handle setting the "active" class on links by:
// - loading the active-link library if the current user is authenticated;
// - applying a response filter if the current user is anonymous.
// @see \Drupal\Core\Link
// @see \Drupal\Core\Utility\LinkGenerator::generate()
// @see template_preprocess_links()
// @see \Drupal\Core\EventSubscriber\ActiveLinkResponseFilter
$page
[
'#cache'
][
'contexts'
][]
=
'user.roles:authenticated'
;
if
(
\Drupal
::
currentUser
()
->
isAuthenticated
())
{
$page
[
'#attached'
][
'library'
][]
=
'core/drupal.active-link'
;
}
}
/**
* Implements hook_preprocess_HOOK() for block templates.
*/
function
system_preprocess_block
(
&
$variables
)
{
function
system_preprocess_block
(
&
$variables
)
:
void
{
switch
(
$variables
[
'base_plugin_id'
])
{
case
'system_branding_block'
:
$variables
[
'site_logo'
]
=
''
;
...
...
@@ -624,6 +404,7 @@ function system_region_list($theme, $show = REGIONS_ALL) {
// If requested, suppress hidden regions. See block_admin_display_form().
foreach
(
$info
[
'regions'
]
as
$name
=>
$label
)
{
if
(
$show
==
REGIONS_ALL
||
!
isset
(
$info
[
'regions_hidden'
])
||
!
in_array
(
$name
,
$info
[
'regions_hidden'
]))
{
// phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString
$list
[
$name
]
=
t
(
$label
);
}
}
...
...
@@ -701,7 +482,7 @@ function _system_is_claro_admin_and_not_active() {
/**
* Implements hook_preprocess_toolbar().
*/
function
system_preprocess_toolbar
(
array
&
$variables
,
$hook
,
$info
)
{
function
system_preprocess_toolbar
(
array
&
$variables
,
$hook
,
$info
)
:
void
{
// When Claro is the admin theme, Claro overrides the active theme's if that
// active theme is not Claro. Because of these potential overrides, the
// toolbar cache should be invalidated any time the default or admin theme
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment