You are here

public function ConfigEntityLayoutBuilderHandler::onParseCdf in Acquia Content Hub 8.2

Handles layout builder data in 3rd party settings on entity_view_displays.

Parameters

\Drupal\acquia_contenthub\Event\ParseCdfEntityEvent $event: The Parse CDF Entity Event.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/EventSubscriber/Cdf/ConfigEntityLayoutBuilderHandler.php, line 46

Class

ConfigEntityLayoutBuilderHandler
Handles config entities for Layout Builder entities.

Namespace

Drupal\acquia_contenthub\EventSubscriber\Cdf

Code

public function onParseCdf(ParseCdfEntityEvent $event) {

  /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity */
  $entity = $event
    ->getEntity();
  if ($entity
    ->getEntityTypeId() !== 'entity_view_display') {
    return;
  }
  $sections = $entity
    ->getThirdPartySetting('layout_builder', 'sections', []);
  if ($sections) {
    $entity
      ->setThirdPartySetting('layout_builder', 'sections', $this
      ->unserializeSections($sections));
  }
}