return $this;
}
+ /**
+ * Update the value of a custom field token.
+ *
+ * @param string $entity
+ * @param int $customFieldID
+ * @param int $entityID
+ * @return TokenRow
+ */
+ public function customToken($entity, $customFieldID, $entityID) {
+ $customFieldName = "custom_" . $customFieldID;
+ $fieldValue = civicrm_api3($entity, 'getvalue', array(
+ 'return' => $customFieldName,
+ 'id' => $entityID,
+ ));
+
+ // format the raw custom field value into proper display value
+ if ($fieldValue) {
+ $fieldValue = \CRM_Core_BAO_CustomField::displayValue($fieldValue, $customFieldID);
+ }
+
+ return $this->tokens($entity, $customFieldName, $fieldValue);
+ }
+
/**
* Update the value of a token. Apply formatting based on DB schema.
*