[RFC] Indicate whether "Is slot" is used for a formatter

Created on 9 May 2024, about 1 month ago
Updated 12 May 2024, about 1 month ago

'RFC': not planned to work on immediately, open to comments from other people who are getting experience with the editing UI.

Current situation

In comparison with Core's list of field formatters on the "Manage Display" screen, we are exposing two extra properties which are logically part of the CE formatter's settings (...which are each individual parts of a CE display entity).

  • Key
  • Is slot

This matches protected functions getName() and isSlot() in CustomElementsFieldFormatterBase. The UI doesn't use these functions but renders the value saved in the config object.

This is in the list of formatters, so that it's easier to

  • edit
  • grasp at a glance (for an experienced person), how an entity would be rendered.

Problem/Motivation

A CE Formatter plugin can do anything, including totally ignoring those 'name' and 'is_slot' properties, e.g.

  • A formatter that sets multiple properties will likely use the Key as a prefix instead of a name -- or just hardcode the names for all properties except one;
  • I imagine that nearly all custom formatters will ignore is_slot.

So, can we do something with this fact to make things stand out in the UI?

Possible resolutions

For the Key, I don't see how we can do much, except

  • Maybe put a help hint/sentence somewhere, that it's up to the individual formatter, how this value is used?
  • Set a good example by having the summary() for every formatter that we ship, which doesn't use the Key literally, specify this.

"Is Slot" is likely more mysterious to people, so it's a bit more important to indicate whether this is actually being used, in the UI.

  • Make a "uses_is_slot" annotation? If set to false, this would indicate that the config value (and the return value of protected function isSlot()) is ignored.
  • ...or (insert alternative here)?
  • (the nuclear option) don't show is_slot in the list, only in the summary + edit form?

Note: the UI (obviously) currently doesn't use protected function isSlot() -- but each formatter should still 'publicly' indicate whether it uses is_slot: we need to know whether to render/enable the checkbox, at the very least when the user selects a new "Formatter".

Also: is it possible to have is_slot be optional in the config schema, and only save it for the formatters that use it?

On a separate but related note: IMHO we need UI help text for "what does this Is Slot thing do". And we shouldn't be afraid to give examples of output for clarification -- even examples of JSON output that can be achieved (using add-on modules). I think it can really help people.

🌱 Plan
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands roderik Amsterdam,NL / Budapest,HU

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024