protected function LayoutBuilderDataHandlerTrait::unserializeSections in Acquia Content Hub 8.2
Prepares Layout Builder sections to be unserialized.
Parameters
array $sections: The Layout Builder sections to unserialize.
Return value
array The prepared sections.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
2 calls to LayoutBuilderDataHandlerTrait::unserializeSections()
- ConfigEntityLayoutBuilderHandler::onParseCdf in src/
EventSubscriber/ Cdf/ ConfigEntityLayoutBuilderHandler.php - Handles layout builder data in 3rd party settings on entity_view_displays.
- LayoutBuilderFieldUnserializer::onUnserializeContentField in src/
EventSubscriber/ UnserializeContentField/ LayoutBuilderFieldUnserializer.php - Handling for Layout Builder sections.
File
- src/
LayoutBuilder/ LayoutBuilderDataHandlerTrait.php, line 75
Class
- LayoutBuilderDataHandlerTrait
- Layout Builder trait for handling data.
Namespace
Drupal\acquia_contenthub\LayoutBuilderCode
protected function unserializeSections(array $sections) {
$values = [];
foreach ($sections as $sectionArray) {
$section = $sectionArray instanceof Section ? $sectionArray : Section::fromArray($sectionArray['section']);
$this
->unserializeComponents($section
->getComponents());
$values[] = $section;
}
return $values;
}