Back to Menu class

Method ordering

public static string
ordering
(mixed &$row, mixed $id)
Build the select list for Menu Ordering
Parameters
  • object $row The row object
  • int $id The id for the row. Must exist to enable menu ordering
Returns
  • string
Since
  • 1.5
Class: Menu
Project: Joomla

Method ordering - Source code

/**
 * Build the select list for Menu Ordering
 *
 * @param   object   $row   The row object
 * @param   integer  $id    The id for the row. Must exist to enable menu ordering
 *
 * @return  string
 *
 * @since   1.5
 */
public static function ordering(&$row, $id)
{
    if ($id) {
        $db = Factory::getDbo();
        $query = $db->getQuery(true)->select([$db->quoteName('ordering', 'value'), $db->quoteName('title', 'text')])->from($db->quoteName('#__menu'))->where([$db->quoteName('menutype') . ' = :menutype', $db->quoteName('parent_id') . ' = :parent', $db->quoteName('published') . ' != -2'])->order($db->quoteName('ordering'))->bind(':menutype', $row->menutype)->bind(':parent', $row->parent_id, ParameterType::INTEGER);
        $order = HTMLHelper::_('list.genericordering', $query);
        $ordering = HTMLHelper::_('select.genericlist', $order, 'ordering', array('list.attr' => 'class="inputbox" size="1"', 'list.select' => (int) $row->ordering));
    } else {
        $ordering = '<input type="hidden" name="ordering" value="' . $row->ordering . '">' . Text::_('JGLOBAL_NEWITEMSLAST_DESC');
    }
    return $ordering;
}