GetFieldOptions($field_name); $label = getArrayValue($options['options'], $value); if ($label !== false) { // option_id found in options array if (getArrayValue($options, 'use_phrases')) { return $this->Application->Phrase($label); } else { return $label; } } else { // option_id not found return "$value" == "0" ? '' : $value; } } function Parse($value, $field_name, &$object) { if ($value == '') return NULL; $options = $object->GetFieldOptions($field_name); $use_phrases = getArrayValue($options, 'use_phrases'); $found = false; foreach ($options['options'] as $option_key => $option_value) { if ($use_phrases) { $option_value = $this->Application->Phrase($option_value); } if ($option_value == $value) { $found = true; break; } } return $found ? $option_key : $value; } }