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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

John_B created an issue. See original summary.

john_b’s picture

Title: pagedesigner_layout will not save layout » pagedesigner_layout will not save unless fields are created manually
Issue summary: View changes
john_b’s picture

Issue summary: View changes
john_b’s picture

Issue summary: View changes
john_b’s picture

Issue summary: View changes
john_b’s picture

Issue summary: View changes

pvbergen made their first commit to this issue’s fork.

pvbergen’s picture

Assigned: Unassigned » pvbergen
Status: Active » Reviewed & tested by the community
pvbergen’s picture

Status: Reviewed & tested by the community » Fixed

  • pvbergen committed 148ae80e on 2.0.x
    Resolve #3305010 "Pagedesignerlayout will not"
    
pvbergen’s picture

Status: Fixed » Needs work

  • pvbergen committed 8c661120 on 2.0.x
    Resolve #3305010 "Pagedesignerlayout will not"
    
pvbergen’s picture

Status: Needs work » Fixed
pvbergen’s picture

Status: Fixed » Closed (fixed)