nikosdion / joomla_extensions_development

Joomla Extensions Development: a reference book
GNU Free Documentation License v1.3
10 stars 1 forks source link

Some more incorrect namespaces #26

Closed HermanPeeren closed 1 year ago

HermanPeeren commented 1 year ago

The issue reported in #24 about component namespaces was only corrected in sections/components.xml, but is also present in sections/concepts.xml.

That section about namespaces in sections/concepts.xml also wrongly states that the vendor namespace prefix of modules and plugins MUST be "\Joomla". This however is not true. You won't get an error if you would do so, but it is NOT correct. See the specification in Joomla's documentation: https://docs.joomla.org/J4.x:Namespace_Conventions_In_Joomla. Example that plugins and modules realy work with your own vendor namespace instead of "\Joomla": see for instance Peter's J4-compatible plugins and modules, starting with "\RegularLabs". In sections/plugins.xml the supposed necessity of "\Joomla" as vendor namespace prefix is repeated.

I will make a PR to correct both issues.

nikosdion commented 1 year ago

I wrote the original version of the namespace conventions in Joomla page. George just took my proposal and expanded it a little bit before putting it in the Wiki.

When I was converting my software for Joomla 4.0 I remember I had spotted a problem if a module or plugin had a namespace which did not start with \Joomla. I no longer see such a problem. It's been two years, I don't even remember what the problem was, I have a faint recollection that there was something with booting the extension. Since it's no longer a problem —and I have confirmed as much with my newest software— I think it can be changed.

Would you like to please do these changes? I am busy with other work for the next couple of months 😕

nikosdion commented 1 year ago

Clarification, since people who are not familiar with the Joomla 4 history might be reading this.

When we had the Joomla 4 round table discussion in Prague (June 2015) the first proposal I put down was that Joomla 4 should be fully namespace and extensions should be too. It was added to that handwritten document which served as the original draft roadmap to Joomla 4.

When we started the first Joomla 4 Working Group meeting in Denmark —as you recall, since you were there— we went through the proposals in that document. For namespaces I had proposed we use what I was already doing with my own extensions based on FOF 3.x, with one notable change: instead of Frontend and Backend we should use Site and Administrator for consistency with the rest of the CMS.

You had all asked me to put this down in writing and so I did. It was a bit terse given the target audience. George took that and expanded it with some more information so that 3PDs would understand what was in our minds without having to read our minds 😅 That's what ended up in the Joomla documentation wiki.

For various reasons it took another 2 ½ years (or something like that) for the code to be written. I only started working on native Joomla 4 MVC as an extensions developer in early 2020 — I had to refactor the interface and JavaScript of my extensions before dealing with the backend code. At that point we were somewhere between the Joomla 4 alpha and early betas. It is very likely I had bumped into an issue which was soon fixed, or I might be misremembering what problem I had at that point. Most likely I suffered the curse of the early adopter 😛

I can tell for sure that you don't need to use the Joomla prefix as of Joomla 4.2. The new plugins and module I am writing have my own vendor namespace.

HermanPeeren commented 1 year ago

Thanks for confirming my thoughts about the history of those namespaces and your text about them. I'll send a PR to change those passages soon, my pleasure.

Best wishes!

HermanPeeren commented 1 year ago

Thanks for merging. At the moment the diagram at https://www.dionysopoulos.me/media/com_docimport/books/assets/JoomlaExtensionNamespace.png gives a 404, so probably something went wrong putting the image in that directory. I'm curious how it looks like in the formatted text ...

Update: is fixed now. Thank you! I'd say: issue can be closed.