Skip to content
Snippets Groups Projects
Commit 97091674 authored by Liam Morland's avatar Liam Morland
Browse files

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!2Tag 1.0.1
......@@ -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);
}
}
}
}
......
......@@ -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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment