Alter a date field rendering

by Pauloscorps   Last Updated January 10, 2018 17:07 PM

I'm working on an existing website running Drupal 7. I have a content type "Event" containing a date field. I need to create a new date format to display the following :

<span class="day">20</span><span class="month">JANU</span>

As you can see, I need a 4 letters truncated month, so the "M" keyword of PHP date() could not work for me. Moreover, I need to add this HTML structure.

So how could I do ? I was searching for altering my field rendering with hook_field_display_alter() but without success. Do you have an idea ?

Tags : 7 fields


Related Questions



How would I create conditional fields on install?

Updated October 13, 2016 09:03 AM