Make showing file type, file size, or both optional

Created on 18 October 2023, 8 months ago
Updated 31 October 2023, 8 months ago

Problem/Motivation

Right now, the module displays both the file size and file type when appending text to the links. That is a nice feature, but I can see where some users would want to only display the file type or maybe only display the file size. I think it would be nice to allow users to choose what they want to display just like they can choose the prefix, suffix, etc.

Proposed resolution

Make the file append text configuration into one variable with placeholder values instead of multiple configuration fields. The field could look something like this with "%extension" and "%size" placeholders and the separator/prefix/suffix included as plain text.

 (%extension - %size)
✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States afinnarn

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

Comments & Activities

  • Issue created by @afinnarn
  • @afinnarn opened merge request.
  • Status changed to Needs review 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States afinnarn

    I've added some PHP Unit tests to cover this code change. I'm used to the old Drupal CI and I have to say the new GitLab instance is much, much better to work with. It even comes with all test running automagically setup with the include of a stock ".gitlab-ci.yml" file. There are warnings about linting errors on the MR, but the unit tests pass. At some point, an issue should be created to take care of the linting errors or change the linting configuration.

    On the MR, I think I've done everything necessary and taken care of people already using the module with the update hook. I will try to test the update hook now locally on a Drupal site, but the code is ready to review.

    I don't have a preference on what the description text is for the appending pattern form field so I'm open to suggestions on that. I think it is clear enough, but maybe there are Drupal conventions to use for describing tokens like that.

  • Status changed to Needs work 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States afinnarn

    Based on feedback from a reviewer I am putting this back into needs work. There is at least an issue with menu links as you can see in the screenshot below.

    ...err welp, I thought the image upload would be different. The menu link text is HTML in a "" tag.

    It would be good if we can add a test at a higher level that works with a Drupal instance, adds media, and then inserts the media for both content and field parsing.

Production build 0.69.0 2024