FOF30\Form\Field\Url::getFieldContents PHP Method

getFieldContents() public method

Method to get the field input markup.
public getFieldContents ( array $fieldOptions = [] ) : string
$fieldOptions array Options to be passed into the field
return string The field HTML
    public function getFieldContents(array $fieldOptions = array())
    {
        $id = isset($fieldOptions['id']) ? 'id="' . $fieldOptions['id'] . '" ' : '';
        $class = $this->class . (isset($fieldOptions['class']) ? ' ' . $fieldOptions['class'] : '');
        $show_link = $this->element['show_link'] == 'true';
        $empty_replacement = $this->element['empty_replacement'] ? (string) $this->element['empty_replacement'] : '';
        if (!empty($empty_replacement) && empty($this->value)) {
            $this->value = JText::_($empty_replacement);
        }
        $value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
        $html = $value;
        if ($show_link) {
            if ($this->element['url']) {
                $link_url = $this->parseFieldTags((string) $this->element['url']);
            } else {
                $link_url = $value;
            }
            $html = '<a href="' . $link_url . '">' . $value . '</a>';
        }
        return '<span ' . ($id ? $id : '') . 'class="' . $class . '"">' . $html . '</span>';
    }