Background + question
The module allows a site builder to add new entries into an entity view mode, configure and position them among the regular fields. These entries exist per view mode / bundle / entity type.
I am wondering what would be the best way to achieve this in Drupal 8. Is one of the ideas below suitable? Why would I use one over the other?
Ideas so far
Idea 1: Extra fields + config entities
hook_entity_extra_field_info() allows to insert "pseudo" fields per entity bundle, but across view modes. The idea would be to use hook_form_alter() to remove the items from those view modes where they don't belong.
I found some documentation on extra fields here: https://www.webomelette.com/creating-pseudo-fields-drupal-8
Entries would be stored as config entities, with keys to determine to which view mode they belong.
For this, I started looking at https://www.drupal.org/docs/8/api/configuration-api/creating-a-configuration-entity-type-in-drupal-8
Idea 2: Learn from field_group and Display suite
field_group does something similar to what I am trying to do. Except that the entries are not pseudo fields, but groups. But still, these are entries or "things" that exist per view mode, and can be created and deleted.
But I found that field_group does not use a config entity type for this. Instead, in
field_group.entity_display.schema.yml, I find this:
core.entity_view_display.*.*.*.third_party.field_group: type: sequence label: 'Field group settings on entity view'
Similar lines can be found in ds.entity_display.schema.yml or field_layout.schema.yml. Although these do not use
type: sequence. I think this is because they store settings for the view mode itself, not for entries within the view mode.
So I wonder, what does the
core.entity_view_display.*.*.*.third_party... mean, and why would I use this + type: sequence, instead of a config entity type?
And if I use this method, would it still make sense to work with hook_entity_extra_field_info() ?