You are here

protected function LayoutBuilderStorage::mapToStorageRecord in Page Manager 8.4

Maps from an entity object to the storage record.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

Return value

array The record to store.

Overrides ConfigEntityStorage::mapToStorageRecord

File

src/Entity/LayoutBuilderStorage.php, line 17

Class

LayoutBuilderStorage
Provides storage for page manager entities that have layouts.

Namespace

Drupal\page_manager\Entity

Code

protected function mapToStorageRecord(EntityInterface $entity) {
  $record = parent::mapToStorageRecord($entity);
  if (!empty($record['variant_settings']['sections'])) {
    $record['variant_settings']['sections'] = array_map(function (Section $section) {
      return $section
        ->toArray();
    }, $record['variant_settings']['sections']);
  }
  return $record;
}