API16:JTableMenuType/check
From Joomla! Documentation
Description
boolean
Syntax
check()
Returns
boolean
Defined in
libraries/joomla/database/table/menutype.php
Importing
jimport( 'joomla.database.table.menutype' );
Source Body
function check()
{
$this->menutype = JApplication::stringURLSafe($this->menutype);
if (empty($this->menutype)) {
$this->setError(JText::_('Menu_Error_Menutype_empty'));
return false;
}
// Sanitise data.
if (trim($this->title) == '') {
$this->title = $this->menutype;
}
$db = &$this->getDbo();
// Check for unique menutype.
$db->setQuery(
'SELECT COUNT(id)' .
' FROM #__menu_types' .
' WHERE menutype = '.$db->quote($this->menutype).
' AND id <> '.(int) $this->id
);
if ($db->loadResult())
{
$this->setError(JText::sprintf('Menu_Error_Menutype_exists', $this->menutype));
return false;
}
return true;
}
Examples
Code Examples