function notifications_format_subscription_field in Notifications 6.3
Same name and namespace in other branches
- 6 notifications.module \notifications_format_subscription_field()
 - 6.2 notifications.module \notifications_format_subscription_field()
 
Format subscriptions field for display and get some more information
Return value
array() Array with 'name' and 'value' elements
1 call to notifications_format_subscription_field()
- notifications_format_subscription in ./
notifications.module  - Format subscription for display
 
File
- ./
notifications.module, line 1819  - Notifications module
 
Code
function notifications_format_subscription_field($type, $value, $html = TRUE, $subtype = NULL) {
  $format_name = $format_value = t('Unknown');
  if ($info = notifications_subscription_fields($type)) {
    $format_name = $info['name'];
    if (!empty($info['format callback'])) {
      if (!empty($info['format callback args'])) {
        $format_value = call_user_func($info['format callback'], $value, $html, $subtype, $info['format callback args']);
      }
      else {
        $format_value = call_user_func($info['format callback'], $value, $html, $subtype);
      }
    }
    elseif (!empty($info['options callback'])) {
      if (!empty($info['options callback args'])) {
        $options = call_user_func($info['options callback'], $subtype, $info['options callback args']);
      }
      else {
        $options = call_user_func($info['options callback'], $subtype);
      }
      $format_value = isset($options[$value]) ? $options[$value] : t('Not available');
    }
    else {
      $format_value = check_plain($value);
    }
  }
  return array(
    'name' => $format_name,
    'value' => $format_value,
  );
}