Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
custom_elements
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
custom_elements
Commits
e32dfa2c
Commit
e32dfa2c
authored
8 months ago
by
Roderik Muit
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3473490
by fago: Fix JSON serialization of markup only slots
parent
071b0d9e
No related branches found
No related tags found
No related merge requests found
Pipeline
#281440
passed with warnings
8 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/CustomElementNormalizer.php
+3
-8
3 additions, 8 deletions
src/CustomElementNormalizer.php
with
3 additions
and
8 deletions
src/CustomElementNormalizer.php
+
3
−
8
View file @
e32dfa2c
...
...
@@ -4,7 +4,6 @@ namespace Drupal\custom_elements;
use
Drupal\Component\Render\MarkupInterface
;
use
Drupal\Core\Render\BubbleableMetadata
;
use
Drupal\Core\Template\Attribute
;
use
Symfony\Component\Serializer\Normalizer\NormalizerInterface
;
/**
...
...
@@ -117,16 +116,12 @@ class CustomElementNormalizer implements NormalizerInterface {
// Handle slots set via nested custom element and markup.
if
(
!
empty
(
$slot
[
'content'
])
&&
$slot
[
'content'
]
instanceof
CustomElement
)
{
$slot_data
[
$index
]
=
$this
->
normalizeCustomElement
(
$slot
[
'content'
],
$cache_metadata
);
// Remove possible doubled slot attributes.
unset
(
$slot_data
[
$index
][
'slot'
]);
}
elseif
(
$slot
[
'content'
]
instanceof
MarkupInterface
)
{
$slot_data
[
$index
][
'content'
]
=
(
string
)
$slot
[
'content'
];
if
(
!
empty
(
$slot
[
'attributes'
])
&&
$slot
[
'attributes'
]
instanceof
Attribute
)
{
$slot_data
[
$index
]
=
array_merge
(
$slot_data
[
$index
],
$slot
[
'attributes'
]
->
toArray
());
}
$slot_data
[
$index
]
=
(
string
)
$slot
[
'content'
];
}
// Remove possible doubled slot attributes.
unset
(
$slot_data
[
$index
][
'slot'
]);
}
if
(
$element
->
hasSlotNormalizationStyle
(
$slot_key
,
CustomElement
::
NORMALIZE_AS_SINGLE_VALUE
))
{
...
...
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