I needed to output an interval field in an email message via a token, but the default field formatter wrapped the interval in a div. I've written a patch to add an "interval_raw" field formatter that allows the interval to be output as plain text.

CommentFileSizeAuthor
raw_field_formatter.patch913 bytesmatt v.

Comments

larowlan’s picture

Status: Active » Needs work
+++ b/sites/all/modules/contrib/interval/interval.moduleundefined
@@ -95,6 +99,13 @@ function interval_field_formatter_view($entity_type, $entity, $field, $instance,
       break;
+    case 'interval_raw':
+      foreach ($items as $delta => $item) {
+        $element[$delta] = array(
+          '#markup' => check_plain(interval_format_interval($item))
+        );
+      }
+      break;
     
   }
 

We need a blank line after the break, but I'll add that before I commit it.

larowlan’s picture

Status: Needs work » Fixed
matt v.’s picture

I think that's the fastest I've ever had a patch applied. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 7d21eed on 7.x-1.x, 8.x-1.x authored by Matt V., committed by larowlan:
    Issue #1549694 by Matt V., larowlan: Added raw field formatter.