Skip to content

Support the plate block type for Plate regions - #2092

Open
sneridagh wants to merge 2 commits into
mainfrom
plate-region-type
Open

sneridagh wants to merge 2 commits into
mainfrom
plate-region-type

Conversation

@sneridagh

Copy link
Copy Markdown
Member

What

Adds support for Plate regions stored with the plate block @type, while keeping the legacy __somersault__ type working.

Why

The unified Plate editor in Plone Aurora renames its storage from

"blocks": {"__somersault__": {"@type": "__somersault__", "value": [...]}}

to

"blocks": {"main": {"@type": "plate", "value": [...]}}

The key is the region name (main now, later also slot names such as aboveContent). The @type plate names the storage format. This PR is step 1 of the migration plan in plone/aurora#379: plone.restapi accepts both names before the frontend switches.

Changes

  • New constants in plone.restapi.blocks: PLATE_BLOCK_TYPE (plate), LEGACY_PLATE_BLOCK_TYPE (__somersault__), and PLATE_BLOCK_TYPES.
  • NestedBlocksVisitor visits blocks nested in the value of any block whose @type is plate or __somersault__, whatever its key.
  • The SearchableText indexer PlateTextIndexer is registered for plate and __somersault__.
  • Link integrity: PlateBlockLinksRetriever now handles plate. A new LegacyPlateBlockLinksRetriever subclass handles __somersault__.
  • The resolveuid serializer and deserializer transforms already handle Plate values through the generic transforms, so they did not need changes. Their tests now cover both types too.

Behavior

Stored as Visitor Indexer Link integrity resolveuid transforms
{"@type": "plate"} under any key (main, aboveContent, ...) yes yes yes yes
{"@type": "__somersault__"} (legacy) yes yes yes yes

Deprecation

__somersault__ is deprecated. Its registrations are marked as such and will be removed in the next major version of plone.restapi.

Tests

The existing Plate tests for the visitor, indexer, link integrity, serializer, and deserializer now run as subtests over main/plate, aboveContent/plate, and __somersault__/__somersault__. The aboveContent case shows that regions are found by @type, not by key.

Assisted-by: Claude Opus 5.5

Plate regions are now stored as `blocks[<region>] = {"@type": "plate", ...}`
(for example `main`). Register the SearchableText indexer and the link
integrity retriever for `plate`, and make the nested blocks visitor handle
both `plate` and the legacy `__somersault__` type. Regions are found by
`@type`, not by key.

`__somersault__` keeps working and is deprecated, to be removed in the next
major version.

Step 1 of plone/aurora#379

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
@mister-roboto

Copy link
Copy Markdown

@sneridagh thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@sneridagh

sneridagh commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

@davisagli meh... what if we want to support all slots in one shot? Should we namespace them?

/cc @ericof

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

Successfully merging this pull request may close these issues.

2 participants