How a delete works from the Joomla Admin - Joomla & VirtueMart Tips & How To's

GJC Web Design UK Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.

Home Joomla - VirtueMart Joomla & VM How To's How a delete works from the Joomla Admin

Sat

27

Sep

How a delete works from the Joomla Admin
  • Joomla 2.5 & 3.0
  • Joomla core

Just for my own info - how a delete works from the Joomla Admin

I have a component with a view "records"

You would have a JS delete button in your view which points to "records.delete" formed in your html.php file  protected function addToolbar() .

//Show trash and delete for components that uses the state field
        if (isset($this->items[0]->state)) {
            if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
                JToolBarHelper::deleteList('', 'records.delete','JTOOLBAR_EMPTY_TRASH');
                JToolBarHelper::divider();
            } else if ($canDo->get('core.edit.state')) {
                JToolBarHelper::trash('records.trash','JTOOLBAR_TRASH');
                JToolBarHelper::divider();
            }
        }

Clicking this calls the controller "records" and could run the function delete() if configured.

If not configured in the "records" controller it  extends JControllerAdmin which is found in "libraries/legacy/controller/admin.php".
This function delete() makes some security checks and then loads the model (GporganiserModelRecord Object) using the getModel function and runs the delete function there if one is configured.
This loads the model for a single "record", not the" records" model.

If no delete is configured in models/record this model then extends "JModelAdmin" in libraries/legacy/model/admin.php which again has the "delete" function.

This model (JModelAdmin) delete() again makes some security checks and triggers some plugin events  then runs the delete function of the libraries/joomla/table/table.php.
This function is found in JTable itself and will run a simple delete query.

Be careful because in the delete functio it call the bind() in the same JTable class.
If for example you have a bind() in administrator/components/com_gporganiser/tables/record.php this will take precedence!

In this case I had

public function bind($array, $ignore = '') {
        $input = JFactory::getApplication()->input;
        $task = $input->getString('task', '');
        if($task != 'save' ) {
            return parent::bind($array, $ignore); //hand back to the JTable bind()
        }
}


 
Last Updated on Saturday, 27 September 2014 19:04
 

Latest Articles

VirtueMart
Your Cart is currently empty.

Paypal Donation

If you use this module on your site please donate a small amount.
Any donation amount appreciated.

Latest Joomla & VirtueMart Tips

See all tips & examples

VM Live Product Search

GJC Web Design UK Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help



How a delete works from the Joomla Admin|Joomla & VirtueMart Tips & How To's



GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.


delete, function, records, model, bind, trash, state, php, joomla, jtoolbarhelper, configured, input, core, controller, libraries, admin, task, record, jtable, jmodeladmin, extends, table, ignore, run, makes, array, loads, checks, security, divider, runs, legacy, cando, jtoolbar, view, components, administrator, gporganiser, tables, precedence


guru

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.