When we want to create a system config we add section
items in the system.xml
file. In these sections we specify a tab
. That tab
needs to also be defined. There is a possibility that a tab is already defined (with all the translations and sort order values), so when one adds a section, there is no need to redefine
that tab again (with all the translations and sort order values).
Here the problem arises. What if the tab was defined in another
module and we need to use in this
module? If we just reference
the tab then we need to specify the module as a dependency. If we redefine
the tab then we do something that we actually have no intention in doing! If we create
another module that just holds the tab it kind of solves the problemm but it is actually a utility module which is not that good of a practice; also other developers might not even know there is a module that's purpose is to be used to reference a tab.
At this stage though it still might seem that arguably the solution with the use of utility module has some justification (despite the drawbacks I've mentioned). However things get worse when we want to reference an admin menu
. In that case we would need another utility module that would just have a menu. And as a consequence we would need even yet another module that would store the ACL resource for it. ACL resource, btw doesn't necessarily mean it is used in the admin only; when dealing with API permissions, these ACL are used as well (outside of admin
scope); which means we absolutely need the separate between the menu
utility and the acl resource
one (because menu is an admin entity and the acl one is not necessarily). So with this approach it clearly becomes a nightmare to manage, remember and actually comunicate well with the team members so that it is properly reused.
It leads us to square one
. To reuse
with the dependency or to redefine
?
The problem with the reusing
is the risk of choosing the wrong module (circular dependency
); for instance there are five modules that use the same tab. How to decide which one should be the one that actually defines it?
If we redefine
, then it's just annoying; why on Earth a dev would need to specify the sort order over and over again when in fact one just want to stick a section
into the system config tab!
And this is actually an important issue
! I've faced this problem with ACL resource scenario with Magento upgrade
; it happened when some inventory modules
were referencing some resources that were not there, but these modules didn't have these dependencies listed: the whole admin did not work
; and there are forums, posts and questions about it like: WTF, I've upgraded a version and now the whole thing is messed up! And the answers are: disable or enable some modules as a fix. That is ridiculous, in my opinion.
Anyway, looking for some guidance and opinions! Thanks!
And for ****'s sake, don't close my question for reasons like "opinion-based", "vague" and etc. I see this architectural deadend as a legitimate problem that I really really keen to resolve!
Thanks!