Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
layout_builder_expand_collapse
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
layout_builder_expand_collapse
Commits
97091674
Commit
97091674
authored
3 years ago
by
Liam Morland
Browse files
Options
Downloads
Plain Diff
Merge branch '1.0.x' into 'prod/1.0.x'
Tag 1.0.1 See merge request
!2
parents
30b91818
5c9e033b
No related branches found
No related tags found
1 merge request
!2
Tag 1.0.1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/EventSubscriber/LayoutBuilderExpandCollapseEventSubscriber.php
+17
-11
17 additions, 11 deletions
...Subscriber/LayoutBuilderExpandCollapseEventSubscriber.php
src/Form/RemoveSectionForm.php
+10
-0
10 additions, 0 deletions
src/Form/RemoveSectionForm.php
with
27 additions
and
11 deletions
src/EventSubscriber/LayoutBuilderExpandCollapseEventSubscriber.php
+
17
−
11
View file @
97091674
...
...
@@ -237,17 +237,23 @@ class LayoutBuilderExpandCollapseEventSubscriber implements EventSubscriberInter
if
(
$formState
->
getValue
([
'op'
])
->
getUntranslatedString
()
==
'Remove'
)
{
/** @var \Drupal\layout_builder_expand_collapse\Form\RemoveSectionForm $formObject */
$formObject
=
$formState
->
getFormObject
();
$questionArgs
=
$formObject
->
getQuestion
()
->
getArguments
();
if
(
isset
(
$questionArgs
[
'@section'
]))
{
// Get the string position after the Section Message.
$afterMsgPosition
=
strpos
(
$questionArgs
[
'@section'
],
$this
->
getSectionMessage
())
+
strlen
(
$this
->
getSectionMessage
());
// Get the group substring, then trim off the
// ': ' at the beginning and the ']' characters at the end.
$group
=
substr
(
substr
(
$questionArgs
[
'@section'
],
$afterMsgPosition
),
2
,
-
1
);
// If the section has expand/collapse enabled then we may need to
// re-align which group is the first in its section.
self
::
alignGroupSettings
(
$formState
,
$group
);
$sections
=
$formObject
->
getSectionStorage
()
->
getSections
();
$delta
=
$formObject
->
getDelta
();
if
(
isset
(
$sections
[
$delta
]))
{
$questionArgs
=
$formObject
->
getQuestion
()
->
getArguments
();
if
(
isset
(
$questionArgs
[
'@section'
]))
{
// Get the string position after the Section Message.
$afterMsgPosition
=
strpos
(
$questionArgs
[
'@section'
],
$this
->
getSectionMessage
())
+
strlen
(
$this
->
getSectionMessage
());
// Get the group substring, then trim off the
// ': ' at the beginning and the ']' characters at the end.
$group
=
substr
(
substr
(
$questionArgs
[
'@section'
],
$afterMsgPosition
),
2
,
-
1
);
// If the section has expand/collapse enabled then we may need to
// re-align which group is the first in its section.
self
::
alignGroupSettings
(
$formState
,
$group
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/Form/RemoveSectionForm.php
+
10
−
0
View file @
97091674
...
...
@@ -22,4 +22,14 @@ class RemoveSectionForm extends OriginalRemoveSectionForm {
return
$this
->
sectionStorage
;
}
/**
* Returns protected property.
*
* @return int
* Section order number (delta).
*/
public
function
getDelta
()
{
return
$this
->
delta
;
}
}
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