Back to OrderingField class

Method getInput

protected string
getInput
()
Method to get the field input markup.
Returns
  • string The field input markup.
Since
  • 3.2
Class: OrderingField
Project: Joomla

Method getInput - Source code

/**
 * Method to get the field input markup.
 *
 * @return  string	The field input markup.
 *
 * @since   3.2
 */
protected function getInput()
{
    $html = array();
    $attr = '';
    // Initialize some field attributes.
    $attr .= !empty($this->class) ? ' class="form-select' . $this->class . '"' : ' class="form-select"';
    $attr .= $this->disabled ? ' disabled' : '';
    $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
    // Initialize JavaScript field attributes.
    $attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
    $itemId = (int) $this->getItemId();
    $query = $this->getQuery();
    // Create a read-only list (no name) with a hidden input to store the value.
    if ($this->readonly) {
        $html[] = HTMLHelper::_('list.ordering', '', $query, trim($attr), $this->value, $itemId ? 0 : 1, $this->id);
        $html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '">';
    } else {
        // Create a regular list.
        $html[] = HTMLHelper::_('list.ordering', $this->name, $query, trim($attr), $this->value, $itemId ? 0 : 1, $this->id);
    }
    return implode($html);
}