FOF30\Form\Field\Button::getInput PHP Method

getInput() public method

Get the rendering of this field type for static display, e.g. in a single item view (typically a "read" task).
Since: 2.0
public getInput ( ) : string
return string The field HTML
    public function getInput()
    {
        $this->label = '';
        $allowedElement = array('button', 'a');
        if (in_array($this->element['htmlelement'], $allowedElement)) {
            $type = $this->element['htmlelement'];
        } else {
            $type = 'button';
        }
        $text = $this->element['text'] ? (string) $this->element['text'] : '';
        $class = $this->class ? $this->class : '';
        $icon = $this->element['icon'] ? '<span class="icon ' . (string) $this->element['icon'] . '"></span> ' : '';
        if ($this->element['listItemTask']) {
            $this->onclick = "listItemTask('cb" . $this->item->getId() . "', '" . (string) $this->element['listItemTask'] . "')";
        }
        $onclick = $this->onclick ? 'onclick="' . $this->onclick . '" ' : '';
        $url = $this->element['url'] ? 'href="' . $this->parseFieldTags((string) $this->element['url']) . '" ' : '';
        $title = $this->element['title'] ? 'title="' . JText::_((string) $this->element['title']) . '" ' : '';
        $useValue = StringHelper::toBool((string) $this->element['use_value']);
        if (!$useValue) {
            $this->value = JText::_($text);
        }
        $html = '<' . $type . ' id="' . $this->id . '" class="btn ' . $class . '" ' . $onclick . $url . $title . '>';
        $html .= $icon . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
        $html .= '</' . $type . '>';
        return $html;
    }