Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The build() method was first created to render emails nicely in InmailMessageSchema. Then in CollectJSON it was implemented to simply output all the properties. That second approach is universally applicable to all schemas. Only for certain schemas there is a need for custom visual representation.
Proposed resolution
As default view, output values of properties defined by schema. As a table.
Make build() optional (move it to a child interface of SchemaInterface?).
Render the build() output under a separate tab that is only visible if build() is supported.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#11 | build-2451161-11.patch | 24.95 KB | Arla |
#7 | build-2451161-7.interdiff.txt | 7 KB | Arla |
#7 | build-2451161-7.patch | 27.1 KB | Arla |
#5 | build-2451161-5.patch | 22.74 KB | Arla |
#5 | build-2451161-5.interdiff.txt | 3.72 KB | Arla |
Comments
Comment #1
ArlaHere's a start.
If the schema implements SpecializedDisplaySchemaInterface, the build() method is used, as here for the Inmail schema:
Otherwise a table is built with the values from the Typed Data API:
Tests not yet considered.
Tabs to be done in #2462945: Use tabs for switching between modes of viewing container data
Comment #3
ArlaRemoved old build() also from CollectJSON. Updated tests.
So far only strings are supported in the table. Let's handle booleans, lists and complex data in a followup.
Comment #5
ArlaUpdated test code.
Comment #7
ArlaMore test updates. Also, the Core field storage form was just updated.
Comment #8
ArlaDiscussed with @miro_dietiker. Making the display less reliant on the build() method is a step in the right direction. But the table layout goes against the entity/field-like display that we have in mind. And the schema plugin should be able to override the display more dynamically, again more like the entity view builders. I think a full value list like this will help when doing #2458499: Schema properties configurable in UI, so let's commit this and make sure the intended path forward is well represented in the issue queue.
Comment #11
ArlaReroll
Comment #12
ArlaComment #13
ArlaCommitted and pushed!
Comment #15
ArlaThe relevant issues are covered by #2463555: [META] Manage display UI