JTableMenuType/check
From Joomla! Documentation
< API16:JTableMenuType
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
boolean
Syntax[edit]
check()
Returns[edit]
boolean
Defined in[edit]
libraries/joomla/database/table/menutype.php
Importing[edit]
jimport( 'joomla.database.table.menutype' );
Source Body[edit]
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[edit]
Code Examples[edit]