You are here

protected function LayoutBuilderDataHandlerTrait::serializeSections in Acquia Content Hub 8.2

Prepares Layout Builder sections to be serialized.

Parameters

\Drupal\layout_builder\Section[] $sections: Sections for layout.

Return value

array The prepared Layout Builder sections.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

2 calls to LayoutBuilderDataHandlerTrait::serializeSections()
EntityViewDisplaySerializer::onSerializeConfigEntity in src/EventSubscriber/SerializeConfig/EntityViewDisplaySerializer.php
Serializes layout_builder 3rd party settings data on entity_view_displays.
LayoutBuilderFieldSerializer::onSerializeContentField in src/EventSubscriber/SerializeContentField/LayoutBuilderFieldSerializer.php
Prepare layout builder field.

File

src/LayoutBuilder/LayoutBuilderDataHandlerTrait.php, line 33

Class

LayoutBuilderDataHandlerTrait
Layout Builder trait for handling data.

Namespace

Drupal\acquia_contenthub\LayoutBuilder

Code

protected function serializeSections(Section ...$sections) {

  // @codingStandardsIgnoreLine
  $return = [];
  foreach ($sections as $section) {
    $this
      ->serializeComponents($section
      ->getComponents());
    $return[] = $section
      ->toArray();
  }
  return $return;
}