Problem/Motivation

Currently, the supported entities are hardcoded. This is okay for most use cases but there may be sites using a different entity type to show its metatags. FOr example, users. Probably we could add user entity type to the array as is a core entity type. But there may exist contributed entities that we are not aware they must be supported. Or custom entities that have their own pages.

Another problem is that it is not possible to configure specific behaviors for entity types which are not nodes or taxonomy terms.

Additionally, the supported_entities constant is not being used in entity view alter. So every content entity type will be checked to add the image alt fallback. THis sounds great, but it adds an unwanted extra check for entities which never will have image fields. Examples can be found in contributed entity types like group relationships , votes, flag, webform submissions. Those are entities used with a purpose beyond a display , so they don't have image fields.

Proposed resolution

  • Add to the configuration form a new field named supported_entities. This field will be a checkboxes field of all the content entities available.
  • Show behavior per entity type only for those supported entities. This can be done with #states api.
  • In hook entity view alter, skip image alt fallback for those images not configured.

Comments

omarlopesino created an issue. See original summary.

omarlopesino’s picture

Issue summary: View changes