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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Arla’s picture

Issue summary: View changes
Status: Active » Needs review
Related issues: +#2462945: Use tabs for switching between modes of viewing container data
FileSize
93.38 KB
83.62 KB
14.24 KB

Here'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

Status: Needs review » Needs work

The last submitted patch, 1: build-2451161-1.patch, failed testing.

Arla’s picture

Status: Needs work » Needs review
FileSize
20.61 KB
7.9 KB

Removed 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.

Status: Needs review » Needs work

The last submitted patch, 3: build-2451161-3.patch, failed testing.

Arla’s picture

Status: Needs work » Needs review
FileSize
3.72 KB
22.74 KB

Updated test code.

Status: Needs review » Needs work

The last submitted patch, 5: build-2451161-5.patch, failed testing.

Arla’s picture

Status: Needs work » Needs review
FileSize
27.1 KB
7 KB

More test updates. Also, the Core field storage form was just updated.

Arla’s picture

Discussed 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.

Arla queued 7: build-2451161-7.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 7: build-2451161-7.patch, failed testing.

Arla’s picture

FileSize
24.95 KB

Reroll

Arla’s picture

Status: Needs work » Needs review
Arla’s picture

Status: Needs review » Fixed

Committed and pushed!

  • Arla committed 304ed42 on 8.x-1.x
    Issue #2451161 by Arla: Standardise property output and make custom...
Arla’s picture

so let's commit this and make sure the intended path forward is well represented in the issue queue

The relevant issues are covered by #2463555: [META] Manage display UI

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.