You are here

protected function LayoutStorageHandler::mapToStorageRecord in Layout builder library 8

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/LayoutStorageHandler.php, line 18

Class

LayoutStorageHandler
Defines a class for storing layout config entities.

Namespace

Drupal\layout_library

Code

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