Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-inline editable blocks cannot be published via "three dots" menu #1310

Open
1 of 2 tasks
TheSceneman opened this issue Jan 27, 2025 · 4 comments
Open
1 of 2 tasks

Comments

@TheSceneman
Copy link

TheSceneman commented Jan 27, 2025

Module version(s) affected

5.3.5

Description

When attempting to publish a block that is non-inline editable via "three dots" menu on the list of elements, an error toast is returned: "Error displaying the edit form for this block"

How to reproduce

Add a non-inline editable block that contains a Gridfield to a page. Click on it, make some edits and save (but don't publish). Go back the page and attempt to publish via the three dots. You'll see an error toast.

Possible Solution

No response

Additional Context

This could be caused by this change in 5.3: https://docs.silverstripe.org/en/5/changelogs/5.3.0/#elemental-validation

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

PRs

@GuySartorelli
Copy link
Member

I can't reproduce this with the steps provided on a fresh installation of silverstripe/installer with dnadesign/silverstripe-elemental as the only additional dependency, and no custom code.

Can you please update the reproduction steps to include everything needed to reproduce this?

@TheSceneman
Copy link
Author

Thanks for the response Guy, I will double check the exact scenario. Might have something to do with child objects

@TheSceneman
Copy link
Author

@GuySartorelli I think this is tied to Gridfields, I commented out the GridField in the getCMSFields() and the block was then publishable. Updated steps to mention gridfield

@GuySartorelli
Copy link
Member

Haven't looked at that yet but that would make sense - I believe in 5.3 we made a change so that the elemental area loads the form in react in order to submit a publish event which obviously will fail with gridfields, since there's no react component for those.

A workaround

As a workaround if you need something urgent you can replace GridField with injector, and in the subclass set the protected schemaType property to FormField::SCHEMA_DATA_TYPE_STRUCTURAL.

This should work, and probably won't have unintended side effects, though I can't promise that.

A fix

A proper fix for this will need to stop loading the form when publishing a non-inline-editable block, which makes sense since you can't edit them in this context anyway, so you don't need to send the field values along with the publish request.

I think inline-editable blocks should still have their data sent in the request in case you're doing a 'save and publish' - though if the publish option isn't visible when you have unsaved changes, then they too can omit that data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants