Steps to reproduce
Clean install of Drupal + Pagedesigner.
Enable pagedesigner_layout.
Create a layout.
Attempt to save the layout.
Look at console.
See Uncaught TypeError: Cannot read properties of undefined (reading 'id') at insert.js?rgyu40:111:61
When attempting to save a layout, there is an Ajax response but it is empty.
In modules/pagedesigner_layout/src/rest/resource/LayoutResource.php, $layout
is created. The code errors with "Error: Attempt to assign property "value" on null" at the line $layout->field_content->value = $requestContent['description'];
. If that is fixed, it errors on the next line.
The cause of the problem is that pagesdesigner_layout/config/optional does not include field definitions, so unless the fields are created in the UI, field_content and field_include_content do not exit on the entity type 'layout'.
Suggested resolution
Write field definition files for field_content and field_include_content. The second appears to be a boolean field.
Check whether entity type 'layout' requires fields other than these two.
UI changes
Arguably this is for a separate ticket, but if we have a field 'field_include_content' we should probably have a checkbox in the UI, perhaps on the "create layout" modal, for including content. Perhaps a checkbox saying "Include content in this layout." As things stand, the UI provides no way which I have found to send data to this field.