/**
* Method to add a new record.
*
* @return boolean True if the record can be added, false if not.
*
* @since 1.6
*/
public function add()
{
$context = "{$this->option}.edit.{$this->context}";
// Access check.
if (!$this->allowAdd()) {
// Set the internal error and also the redirect error.
$this->setMessage(Text::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED'), 'error');
$this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false));
return false;
}
// Clear the record edit information from the session.
Factory::getApplication()->setUserState($context . '.data', null);
// Redirect to the edit screen.
$this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(), false));
return true;
}