Simplify ClientServerConversionTrait::clientLayoutToServerTree()

Created on 19 February 2025, about 2 months ago

Overview

Working on πŸ“Œ Consider refactoring page_template into page_region(s) Active made me discover that \Drupal\experience_builder\Controller\ClientServerConversionTrait::clientLayoutToServerTree() had logic to strip away nodeType: region from the given $layout, prior to mapping to the edited content entity's XB field and the regions inside the PageTemplate (if that was in use).

But as of #3501600, that's:

  • still in use for the special content region (to map to the edited content entity's XB field)
  • no longer in use for all other regions

Why? Because \Drupal\experience_builder\Entity\PageRegion::forAutoSaveData() knows that the containing nodeType: region is just a container that doesn't need to be stored, so it extracts the layout information from the region node:

$tree = self::clientLayoutToServerTree($autoSaveData['layout']);

Proposed resolution

\Drupal\experience_builder\ClientDataToEntityConverter::convert() can do the same for the special "content" region.

That in turn allows ClientServerConversionTrait::clientLayoutToServerTree() to be simplified.

Which helps pave the path for refactoring ClientServerConversionTrait away.

User interface changes

None.

πŸ“Œ Task
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024