Index: branches/RC/core/kernel/utility/formatters/options_formatter.php =================================================================== diff -u -N -r9343 -r10095 --- branches/RC/core/kernel/utility/formatters/options_formatter.php (.../options_formatter.php) (revision 9343) +++ branches/RC/core/kernel/utility/formatters/options_formatter.php (.../options_formatter.php) (revision 10095) @@ -4,19 +4,43 @@ function Format($value, $field_name, &$object, $format=null) { - if ( is_null($value) ) return ''; + if ( is_null($value) ) { + return ''; + } - $options = $object->GetFieldOptions($field_name); + $field_options = $object->GetFieldOptions($field_name); + if (!array_key_exists('options', $field_options) || !is_array($field_options['options'])) { + trigger_error('Options not defined for '.$object->Prefix.' field '.$field_name.'', E_USER_WARNING); + return $value; + } - $label = getArrayValue($options['options'], $value); + $options = $field_options['options']; + $use_phrases = array_key_exists('use_phrases', $field_options) ? $field_options['use_phrases'] : false; + + if (strpos($value, '|') !== false) { + // multiple checkboxes OR multiselect + $values = explode('|', substr($value, 1, -1) ); + $labels = Array (); + foreach ($values as $value) { + $label = $this->formatOption($value, $options, $use_phrases); + if ($label) { + $labels[] = $label; + } + } + + return implode($format, $labels); + } + else { + return $this->formatOption($value, $options, $use_phrases); + } + } + + function formatOption($value, $options, $use_phrases = true) + { + $label = getArrayValue($options, $value); if ($label !== false) { // option_id found in options array - if (getArrayValue($options, 'use_phrases')) { - return $this->Application->Phrase($label); - } - else { - return $label; - } + return $use_phrases ? $this->Application->Phrase($label) : $label; } else { // option_id not found