API16

Difference between revisions of "JControllerForm/add"

From Joomla! Documentation

< API16:JControllerForm
(New page: ===Description=== Method to add a new record. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki...)
 
m (preparing for archive only)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
Method to add a new record.  
 
Method to add a new record.  
  
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[Description:JControllerForm/add|Edit Descripton]]<nowiki>]</nowiki>
 
</span>
 
  
{{Description:JControllerForm/add}}
+
 
 +
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 53: Line 51:
 
</source>
 
</source>
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[</nowiki>[[SeeAlso:JControllerForm/add|Edit See Also]]<nowiki>]</nowiki>
+
<! removed transcluded page call, red link never existed >
</span>
 
{{SeeAlso:JControllerForm/add}}
 
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=add
 
  category=add
 
  category=JControllerForm
 
  category=JControllerForm
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 20:25, 24 March 2017

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]

Method to add a new record.


<! removed transcluded page call, red link never existed >

Syntax[edit]

add()


Defined in[edit]

libraries/joomla/application/component/controllerform.php

Importing[edit]

jimport( 'joomla.application.component.controllerform' );

Source Body[edit]

public function add()
{
        // Initialise variables.
        $app            = JFactory::getApplication();
        $context        = "$this->_option.edit.$this->_context";

        $tmpl           = JRequest::getString('tmpl');
        $layout         = JRequest::getString('layout', 'edit');
        $append         = '';

        // Setup redirect info.
        if ($tmpl) {
                $append .= '&tmpl='.$tmpl;
        }
        if ($layout) {
                $append .= '&layout='.$layout;
        }

        // Access check.
        if (!$this->_allowAdd())
        {
                $this->setRedirect(JRoute::_('index.php?option='.$this->_option.'&view='.$this->_view_items, false));
                return JError::raiseWarning(403, 'JError_Core_Create_not_permitted.');
        }

        // Clear the record edit information from the session.
        $app->setUserState($context.'.id', null);
        $app->setUserState($context.'.data', null);

        // Redirect to the edit screen.
        $this->setRedirect(JRoute::_('index.php?option='.$this->_option.'&view='.$this->_view_item.$append, false));
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]