Time for action – developing custom field formatter
Let's open the recipe page we created just before developing our custom module. On our recipe page which we created using our custom content type, all time fields (cookTime and prepTime) values are displayed in minutes, for example, 60 minutes and 90 minutes. It would be nice if 60 minutes was displayed as 1 hour and 90 minutes was displayed as 1 1⁄2 hours.
One way we can make this happen is to develop a custom module to create a custom field formatter that will display the duration related fields of cookTime and prepTime as hours instead of minutes.
Following are the basic steps involved in creating a new plugin or creating a custom field formatter:
- Create the custom formatter class. This class ...