After googling,etc. I've arrived at the below code to Add a new Category to Joomla so that all the plugin events, etc. get done.
$basePath = JPATH_ADMINISTRATOR.'/components/com_categories'; require_once $basePath.'/models/category.php'; $catmodel = new CategoriesModelCategory(array('table_path' => $basePath.'/tables')); $myArrayOfData = array('id'=>'0','title'='my title'...); $catmodel->save($myArrayOfData);
As it is now, I use the same code to update the record, but instead of a fresh copy of the data array to add, I use SQL to get the existing record as an array, then modify and save the same way.
This "works", but doesn't seem like the right way to do it, so I'm curious how to load the Model using the id of the Category , then use it's methods to change/save. I've tried following the code that executes when the Category Component does it, but too many things are going on for me to nail down how it's done.