The search results provide a good example of how the `onExtensionAfterUninstall` event can be used in a Joomla plugin:
Key points:
- The `onExtensionAfterUninstall` event is triggered after an extension is uninstalled in Joomla.
- It allows you to perform additional processing or cleanup when an extension is uninstalled.
- In the example, the `onExtensionAfterUninstall` event is used to find and remove a package associated with the uninstalled extension.
Here is the relevant code snippet from the search results:
php
// find and remove package
$package_id = $extension->find(array('type' => 'package', 'element' => 'pkg_jce'));
if ($package_id) {
// remove
$plg_extension_joomla->onExtensionAfterUninstall($installer, $package_id, true);
}
This code first finds the package associated with the uninstalled extension using the `$extension->find()` method. It then calls the `onExtensionAfterUninstall()` method of the `PlgExtensionJoomla` class, passing in the installer object, the package ID, and a boolean flag indicating that the uninstallation was successful.
This allows the plugin to perform any necessary cleanup or additional processing when the extension is uninstalled, such as removing associated packages or data.
The search results provide a good example of how to use the `onExtensionAfterUninstall` event in a Joomla plugin to handle the uninstallation of an extension.
Citations:[1] https://github.com/joomla/joomla-cms-examples/blob/master/plugins/extension/example/example.php
[2] https://github.com/joomla/joomla-cms/issues/31378
[3] https://forum.joomla.org/viewtopic.php?t=968927
[4] https://www.joomlatools.com/extensions/logman/developer/plugins/joomla-framework
[5] https://infofish.org/Webinar/index.php/component/sppagebuilder/?id=127&view=page