Skip to content
Snippets Groups Projects

Initial PoC for saving and reloading model and layout.

Merged Dave Long requested to merge issue/experience_builder-3478299:3478299-autosave-poc into 0.x
Files
6
@@ -13,11 +13,17 @@ use Symfony\Component\HttpFoundation\JsonResponse;
final class ApiLayoutController {
use NotTheGoodAutoSaveTrait;
public function __invoke(FieldableEntityInterface $entity): JsonResponse {
if ($entity->bundle() !== 'article') {
throw new \LogicException('For now, this assumes the entity is an article!');
}
if ($body = $this->getAutoSaveData($entity)) {
return new JsonResponse($body);
}
$item = $entity->get('field_xb_demo')->first();
assert($item instanceof ComponentTreeItem);
$tree = $item->get('tree');
Loading