english/libraries/joomla/application/component/controllerform.php
/**
	 * Method to add a new record.
	 *
	 * @return  mixed  True if the record can be added, a JError object if not.
	 * @since   11.1
	 */
Method to add a new record.
@return  mixed  True if the record can be added, a JError object if not.
Method to add a new record . @return mixed True if the record can be added a JError object if not .
public function add()
	{
		$app		= JFactory::getApplication();
		$context	= "$this->option.edit.$this->context";
		if (!$this->allowAdd()) {
			$this->setError(JText::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED'));
			$this->setMessage($this->getError(), 'error');
			$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
			return false;
		}
		$app->setUserState($context.'.data', null);
		$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend(), false));
		return true;
	}
public function add ( ) { $ app = JFactory :: getApplication ( ) ; $ context = " $ this -> option .edit. $ this -> context " ; if ( ! $ this -> allowAdd ( ) ) { $ this -> setError ( JText :: _ ( 'JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED' ) ) ; $ this -> setMessage ( $ this -> getError ( ) , 'error' ) ; $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=' . $ this -> option . '&view=' . $ this -> view_list . $ this -> getRedirectToListAppend ( ) , false ) ) ; return false ; } $ app -> setUserState ( $ context . '.data' , null ) ; $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=' . $ this -> option . '&view=' . $ this -> view_item . $ this -> getRedirectToItemAppend ( ) , false ) ) ; return true ; }
Method to add a new record.
Method to add a new record .
// Initialise variables. // Access check. // Set the internal error and also the redirect error. // Clear the record edit information from the session. // Redirect to the edit screen.