Back to AbstractMenu class

Method setDefault

public bool
setDefault
(mixed $id, mixed $language = '*')
Set the default item by id and language code.
Parameters
  • int $id The menu item id.
  • string $language The language code (since 1.6).
Returns
  • bool True if a menu item with the given ID exists
Since
  • 1.5
Class: AbstractMenu
Project: Joomla

Method setDefault - Source code

/**
 * Set the default item by id and language code.
 *
 * @param   integer  $id        The menu item id.
 * @param   string   $language  The language code (since 1.6).
 *
 * @return  boolean  True if a menu item with the given ID exists
 *
 * @since   1.5
 */
public function setDefault($id, $language = '*')
{
    if (isset($this->getMenu()[$id])) {
        $this->default[$language] = $id;
        return true;
    }
    return false;
}