You are here

protected function DashboardStorage::mapToStorageRecord in Dashboards with Layout Builder 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/DashboardStorage.php \Drupal\dashboards\Entity\DashboardStorage::mapToStorageRecord()

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/DashboardStorage.php, line 30

Class

DashboardStorage
Class DashboardStorage.

Namespace

Drupal\dashboards\Entity

Code

protected function mapToStorageRecord(EntityInterface $entity) {
  $record = parent::mapToStorageRecord($entity);

  /**
   * @var integer $delta
   * @var \Drupal\layout_builder\Section $section
   */
  foreach ($record['sections'] as $delta => $section) {
    $record['sections'][$delta] = $section
      ->toArray();
  }
  return $record;
}