FileLinkClassFormatter: use filename for link text

Created on 21 February 2024, 7 months ago
Updated 29 July 2024, about 2 months ago

Problem/Motivation

File link (with class) formatter uses the host entity's label (e.g. the node/page title) for link text when "Use description as link text" is not enabled.

I think it would be preferable to fall back to the filename as link text in this case, as there's little guarantee that the host entity title will be a suitable descriptor for the file. Core's Generic file formatter also uses filename in this circumstance.

I guess this could be offered behind a new setting.

Steps to reproduce

  1. Use the File link (with class) formatter for a field, do not enable the "Use description.." option
  2. View an entity with a file field—the link text for the file will be the same as the entity title.

For comparison:

  1. Change the field's formatter to Generic file (again do not enable "Use description..."
  2. View the entity—the link text will be the filename.

Proposed resolution

Fall back to filename rather than host entity label when description is not enabled or available—possibly as an option behind a new setting.

Remaining tasks

User interface changes

Possible new setting for filename option.

API changes

Data model changes

Possible new setting in schema

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States justcaldwell

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024