Back to Pagination class

Method getLimitBox

public string
getLimitBox
()
Creates a dropdown box for selecting how many records to show per page.
Returns
  • string The HTML for the limit # input box.
Since
  • 1.5
Class: Pagination
Project: Joomla

Method getLimitBox - Source code

/**
 * Creates a dropdown box for selecting how many records to show per page.
 *
 * @return  string  The HTML for the limit # input box.
 *
 * @since   1.5
 */
public function getLimitBox()
{
    $limits = array();
    // Make the option list.
    for ($i = 5; $i <= 30; $i += 5) {
        $limits[] = HTMLHelper::_('select.option', "{$i}");
    }
    $limits[] = HTMLHelper::_('select.option', '50', Text::_('J50'));
    $limits[] = HTMLHelper::_('select.option', '100', Text::_('J100'));
    $limits[] = HTMLHelper::_('select.option', '0', Text::_('JALL'));
    $selected = $this->viewall ? 0 : $this->limit;
    // Build the select list.
    if ($this->app->isClient('administrator')) {
        $html = HTMLHelper::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="form-select" onchange="Joomla.submitform();"', 'value', 'text', $selected);
    } else {
        $html = HTMLHelper::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="form-select" onchange="this.form.submit()"', 'value', 'text', $selected);
    }
    return $html;
}