You are here

function notifications_field_format_value in Notifications 6.4

Format field value

Parameters

$type: Field type

$value: Field value

$html: Whether to format the field as HTML (if FALSE will return plaintext format)

$subscription: Subscription instance or template for which we want to format this field

2 calls to notifications_field_format_value()
Notifications_Subscription::format_field in includes/notifications_subscription.class.inc
Format subscriptions field for display and get some more information
notifications_subscription_list_form in ./notifications.pages.inc
List form for subscriptions of the same type for a user

File

includes/object.inc, line 225
Notifications object and fields

Code

function notifications_field_format_value($type, $value, $html = TRUE, $subscription = NULL) {
  if ($format_info = notifications_field_get_info($type, 'format callback')) {
    $format_value = _notifications_info_callback($format_info, 'format callback', array(
      $value,
      $html,
    ));
  }
  elseif ($options = notifications_field_subscription_options($type)) {

    // If not we try options callback, we can get the name from the array of options
    $format_value = isset($options[$value]) ? $options[$value] : t('Not available');
  }

  // If nothing got, we return the value
  if (!isset($format_value)) {
    $format_value = check_plain($value);
  }
  return $format_value;
}