Joomla Asked by Chaosxmk on September 5, 2021
I’ve created a component for handling a multitude of things for my clients, but I frequently get feedback that certain sections aren’t needed or that additional sections are desired. The first solution that came to mind was to strip the component down to just core functions and create separate "addon" packages for installing each extra view.
Unfortunately, I’m not quite sure what I need to search for to figure out how to start something like this. The first/only thing I did find was documentation on how to update a component, but that feels a bit janky as a solution since each addon would need a copy of the core code and might make things a bit messy down the line.
So, after having done some research and testing various things, I have an answer.
I created a spin-off of my component and stripped it down to the bare minimum. Every file that would theoretically already by included in the core was removed, only the controllers/models/tables/views were kept. Ex: (items prefixed with × were deleted)
/script.php
/administrator
/controllers
× /controlpanel.php
/bulletin.php
/bulletinlist.php
× /css
/general.css
/models
× /controlpanel.php
/bulletin.php
/bulletinlist.php
/tables
/bulletin.php
/views
× /controlpanel
/bulletin
/bulletinlist
/controller.php
/core.php
/model.php
/view.php
×/languages
/administrator
/en-GB
/en-GB.com_component.ini
/site
/en-GB
/en-GB.com_component.ini
/site
/controllers
/bulletin.php
/bulletinlist.php
/models
/bulletin.php
/bulletinlist.php
/views
/bulletin
/bulletinlist
/controller.php
/core.php
/model.php
/router.php
/view.php
In the manifest file for the installation, it's important to also trim this down to the needed content, and make sure that <extension>
has the attribute method="upgrade"
, otherwise Joomla will cancel the install due to the component already existing.
Important things to note:
<administration>
section of the manifest file, it's better to remove any reference to <menu>
or <submenu>
, I've noticed that it will erase whatever menu items existed already to replace them with the structure included in the upgradeI don't have access to Joomla 4 at the moment to test if this will work there as well, but considering the wording in the Joomla documentation I don't see why it wouldn't work.
Update:
After testing some more, I've noticed that any file that is in the root of a folder (/administrator
or /site
) will be deleted if not referenced in the manifest file. It looks like those files will have to be included even if they aren't different from the core files.
Answered by Chaosxmk on September 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP