/** * There is no need to translate the value for text fields * * @param object $data - the object with the field value * @param string $valueToTranslate - the value for the field * * @return string */ public function render($data, $valueToTranslate) { $options = CompojoomFormCustom::getOptionsArray($data->options); $value = $valueToTranslate; // If we have a checked value, then let's output it if (isset($options['value_checked'])) { $value = $options['value_checked']; if (isset($options['translate'])) { $value = JText::_($value); } return $value; } return $value; }
/** * Let's get the translated label for the value! * * @param object $data - the object with the field value * @param string $valueToTranslate - the value for the field * * @return string */ public function render($data, $valueToTranslate) { $options = CompojoomFormCustom::getOptionsArray($data->options); if (is_array($valueToTranslate)) { $translated = array(); foreach ($valueToTranslate as $kkey => $vvalue) { foreach ($options as $key => $value) { if ($key == $vvalue) { $translated[] = JText::_($value); } } } return implode(', ', $translated); } else { foreach ($options as $key => $value) { if ($key == $valueToTranslate) { return JText::_($value); } } } return $valueToTranslate; }