Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there,
I'd like to use this module for my music website to display the length of songs. I'd like to be able to format the time like this '(3:21)' rather than '3min 21sec'. Would it be possible to add a display formatter to the module which shows the values separated by commas?
Even better! Could you have a text box on the manage display page to input a php style date format string so that people can customise their output?
I ended up copying some of the code and adding a new display formatter with a format string option. A patch is attached although it was quite rushed.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1443432-1.custom-formatter.patch | 3.83 KB | ksenzee |
new_formatter.patch | 3.04 KB | robwithhair |
Comments
Comment #1
ksenzeeI needed this same functionality, and this patch was just the ticket. I tightened it up a bit (code style, cleaned up t(), used switch statements throughout).
Note that this formatter is not just for colon formatting: it lets you use any custom formatting you can display with a php date format string.
Comment #2
simon_s CreditAttribution: simon_s commentedThanks, brilliant, exactly what I looked for!
Patch #1 works fine!