Back to Category class

Method check

public bool
check
()
Override check function
Returns
  • bool
Since
  • 1.5
-
  • \Joomla\CMS\Table\Table::check()
Class: Category
Project: Joomla

Method check - Source code

/**
 * Override check function
 *
 * @return  boolean
 *
 * @see     Table::check()
 * @since   1.5
 */
public function check()
{
    try {
        parent::check();
    } catch (\Exception $e) {
        $this->setError($e->getMessage());
        return false;
    }
    // Check for a title.
    if (trim($this->title) == '') {
        $this->setError(Text::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_CATEGORY'));
        return false;
    }
    $this->alias = trim($this->alias);
    if (empty($this->alias)) {
        $this->alias = $this->title;
    }
    $this->alias = ApplicationHelper::stringURLSafe($this->alias, $this->language);
    if (trim(str_replace('-', '', $this->alias)) == '') {
        $this->alias = Factory::getDate()->format('Y-m-d-H-i-s');
    }
    return true;
}