pagedesigner_layout will not save unless fields are created manually

Created on 21 August 2022, almost 2 years ago
Updated 12 June 2023, about 1 year ago

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.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024