It seems I am not going to solve my problems just by using Extra Fields and from what I read I need to write a K2 plugin. I am a php programmer so that is not a problem, but I need some documentation on how to set things up.
I have downloaded the K2 Plugin Example, but some things are still not clear. For example, the class definition. Is this the correct syntax?
class plgK2MyPluginName extends K2Plugin { function plgK2MyPluginName(&$subject,$params){ parent::__construct($subject,$params); } }
I can't find any trigger names I can use when the user is submitting a front-end form. I need to do stuff like generating a title The item is for an event and contains a date and time and a description that might be empty. I need a generated title so it will give enough information for the admins when they check the list of items.
Also, the Publish Down date should be the event date + 7 days, the category is hidden (set in the menu item to add an event).
I want control of those basic joomla fields and not bother the user with that. I assume that is only possible in an OnSave event function. The plugin description mentions 6 events available for editing. But why can I not find any info on this?
Next, what is the DOM so I can access the item's properties, read extra fields from the database and save them in the item (or just on the screen) before editing its values and reading them back for writing into the database on Save?
If it's a new item it will be null on the BeforeSave event. You need to take a look at the /administrator/component/com_k2/models/item.php to see how you can get it from the POST data. But, as i have mentioned again you do not need to handle this. K2 will save those fields automatically. You can manipulate them in the AfterSave event. Also do not post duplicate posts.