Finally I have discovered how to do this satisfactorily.
My requirement is to be able to create some tags - for example when installing xbCulture Components or when converting xbRefs Text References to Tag References in xbRefMan. These tags need to have a description and parent set as well as just a title so the simple function in TagsHelper::createTagsFromField(array())
does not cut the mustard. It only lets you create simple tags with just a title, and has a weird syntax whereby the title string has to be prefixed with #new#
I was confused of exactly what order various functions of the install/unintsall script run with a package.
This is what my tests show (Joomla 3.10)
Assuming a package with a number of elements (plugins in this case)
On install the following order of functions:
- Package preflight()
- plugin1 preflight()
- plugin1 install()
- plugin1 postflight()
- plugin2 preflight()
- plugin2 install()
- plugin2 postflight()
- ... and so on for any other extensions in the order that they appear in the package xml
- Package install()
- Package postflight()
So the package install() and postflight() are run after all the extensions have installed
The extensions can generate messages $app->enqueueMessage() which will display, but any html output echo'd in their functions will not be shown (unless passed to the message queue
For a given message type the messages will appear in one block in the order in which they are generated.
For uninstall the following order applies
- Package uninstall()
- plugin1 preflight()
- plugin1 uninstall()
- plugin2 preflight()
- plugin2 uninstall()
Note that Package preflight() does not run, but the extension preflight()s do.
None of the postflights() run
The extension order is again as found in the package xml file
With two components it goes like this
Install:
Joomla Form Field items have a useful attribute "showon" which allows you to automatically only display the field if certain other field conditions you specify are met. This can greatly reduce clutter in the form as irrelevant elements remain hidden until they need to be set.
For a simple example you might have enable categories for a component, and also want to set a default category if categories are enabled.
Since I develop Joomla extensions only for my own use, and then make them available if it seems that others might find them useful, I only test compatibility with Browsers and Server configurations that I actually use.
Currently I am only mostly using the Edge browser on Linux (Ubuntu 20.0.4) and Android mobile devices - so I make no attempt to check how things look with other browsers - if something looks wrong to you then by all means send me details and I'll look into correcting it dreckly.
Similarly all websites I manage are running on Ubuntu 20.0.4 and using Apache, MariaDB, and PHP 7.4. For Joomla extensions I am only bothering with Joomla 3.9/10 and making no attempt to check earlier versions and have no plans to switch to Joomla 4 anytime soon. In fact I currently anticipate never switching any existing site to J4 (what would be the point - if it ain't broke don't fix it) and will only use J4 for any new site if someone pays me to.
Page 6 of 12