1 list.module list_boolean_display_value_with_format($value, $format, array $options = array())

Prepare the boolean display.

File

core/modules/field/modules/list/list.module, line 580
Defines list field types that can be used with the Options module.

Code

function list_boolean_display_value_with_format($value, $format, array $options = array()) {
  $formats = list_boolean_display_formats($options);
  if (!isset($formats[$format])) {
    // If format is invalid, default to the first available format.
    reset($formats);
    $format = key($formats);
  }
  if (!empty($options['reverse'])) {
    $value = !(bool) $value;
  }
  // The first format value is the 'On' value, the second is the 'Off' format.
  return !empty($value) ? $formats[$format][0] : $formats[$format][1];
}