public function getRepeatable()
{
// Get field parameters
$class = $this->class ? $this->class : $this->id;
$format_string = $this->element['format'] ? (string) $this->element['format'] : '';
$link_url = $this->element['url'] ? (string) $this->element['url'] : '';
$empty_replacement = $this->element['empty_replacement'] ? (string) $this->element['empty_replacement'] : '';
if ($link_url && $this->item instanceof DataModel) {
$link_url = $this->parseFieldTags($link_url);
} else {
$link_url = false;
}
if ($this->element['empty_replacement']) {
$empty_replacement = (string) $this->element['empty_replacement'];
}
// Ask GenericList::getOptionName to not automatically select the first value
$value = GenericList::getOptionName($this->getOptions(), $this->value, 'value', 'text', false);
// Get the (optionally formatted) value
if (!empty($empty_replacement) && empty($value)) {
$value = JText::_($empty_replacement);
}
if (empty($format_string)) {
$value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
} else {
$value = sprintf($format_string, $value);
}
// Create the HTML
$html = '<span class="' . $class . '">';
if ($link_url) {
$html .= '<a href="' . $link_url . '">';
}
$html .= $value;
if ($link_url) {
$html .= '</a>';
}
$html .= '</span>';
return $html;
}