?
avatar Ninja-007
Ninja-007
28 Dec 2018

Steps to reproduce the issue

I am looking for a Joomla 4 architecture based extension (i.e. component) development guide. After going through the Allon Moritz videos on youtube, have landed in Dispatcher problem. Dispatcher is not getting called. Due to lack of the development documentation, I am not sure if it is a bug in J4 or my mistake. After searching on internet, unfortunately I could not find a help.
I am looking for Joomla 4 architecture based component development tutorial or boilerplate code.
When will be J4 development documentation or tutorials available?

Expected result

Development documentation

Actual result

No documention except Allon Moritz video, a PDF.

System information (as much as possible)

Not required

Additional comments

avatar Ninja-007 Ninja-007 - open - 28 Dec 2018
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Dec 2018
avatar Ninja-007
Ninja-007 - comment - 28 Dec 2018

I have attached the error message below if anyone wants to dig in. Even if kind someone helps me, asking small problems here will not be good idea.

`An error has occurred.

404 **Component not found.** 

Call stack

Function Location

1 () JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:59
2 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:380
3 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:116
4 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:159
5 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:233
6 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:63
7 require_once() JROOT/administrator/index.php:36 `

avatar tonypartridge
tonypartridge - comment - 29 Dec 2018

Did you look at com_content for examples? It sounds like your not name spacing or migrating to the correct structure/classes.

Docs are not yet done as architectural changes could still be made.

avatar joomdonation
joomdonation - comment - 29 Dec 2018

I would not suggest looking at com_content as it's too complicated and not easy to understand. For starting, I think a simpler component like com_contact would be a good start

Back to your issue, I think the error happens because you haven't had the services provider file defined for your component yet. Creating a file similar to this one https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_cpanel/services/provider.php , put it under your component, replace \Joomla\Component\Cpanel with namespace of your component to see whether it solves your issue.

avatar Ninja-007
Ninja-007 - comment - 29 Dec 2018

@tonypartridge thanks for the reply. I saw the com_content. The admin part does not have dispatcher. How does work, it is a question for me.

@joomdonation The cpanel example helped. There was a problem with undefined service provider. Now, I am able to see my multiple views using single controller. Thanks

I want to use multiple controllers to separate tasks logically. How can I create different controllers based on url param e.g. controller=settings, controller=gdpr etc.? In J3, I used to do it in component entry file. Ideally it should be in dispatcher now.

avatar joomdonation
joomdonation - comment - 30 Dec 2018

@Ninja-007 Your component does not need dispatcher. If no dispatcher is available, default component dispatcher will be used. You only have to implement the dispatcher in your component if you want to override the default behavior. The job of a dispatcher is simple: parse the request, find the controller, check permission, then execute the requested task and finally, perform redirection when the task is done if redirect is set in the controller.

For multiple controllers question, you can still use the Joomla 3 way: Passing it via task variable like task=settings.save, task=gdpr.save...

If task does not have that format, Joomla will look for controller via controller variable and if no controller is passed, Display controller will be used. See https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Dispatcher/ComponentDispatcher.php#L112 to understand the logic behind it.

Hope this helps.

avatar Ninja-007 Ninja-007 - change - 8 Jan 2019
Title
[J4 Doc] Looking for Joomla 4 development document
[J4 Doc] Looking for Joomla 4 extension development document
avatar Ninja-007 Ninja-007 - edited - 8 Jan 2019
avatar Ninja-007
Ninja-007 - comment - 10 Jan 2019

Thanks for all of you.

Is there any way to disable legacy mode in an extension on J4 for the extension? This will help to verifiy that the extension code does not use any J3 legacy classes and conform 100% to the J4 format.

avatar mbabker
mbabker - comment - 10 Jan 2019

There is no such thing as "legacy mode". Ensure your extension is not using deprecated resources and you are fine. If it is not marked as deprecated that means there is no current plan for changing or removing that API.

avatar Ninja-007
Ninja-007 - comment - 21 Jan 2019

Related issue #23517

avatar alex7r
alex7r - comment - 13 Feb 2019

@mbabker There is no such thing as "legacy mode".
Actually there is "no legacy mode switcher", but something that can be called "legacy mode" is almost named like it in code itself:
image

@Ninja-007 you can comment or remove the legacy fallback at html/libraries/src/Extension/ExtensionManagerTrait.php:130.
For test purposes only of course.

@joomdonation Yes, and looking at com_content is the only help that we have right now. But I believe in future there should be some docs populated like we have for current version at least: https://docs.joomla.org/J3.x:Developing_an_MVC_Component

avatar mbabker
mbabker - comment - 13 Feb 2019

That is not "legacy mode". That is a B/C compatibility layer ensuring that old code works with the new conventions, as any architectural change should do. Class names or comments containing the word "legacy" do not equate to a legacy mode, which in Joomla terminology refers to a very specific thing that existed in Joomla 1.5.

avatar Ninja-007
Ninja-007 - comment - 13 Feb 2019

Backward compatibility of J4 to J3 extensions is a Legacy mode for me. I have my own extensions and some third party extensions. My extensions should be in J4 architecture and NOT J3 compatible. They should use namespaces, new event system, new classe names etc.

So I my question was, instead of reading code of my extensions (developed by someone in the team) which it time consuming, it would be great to have some simple way to disable B/C compatibility in J4 for a particular extension and see see UI errors/warnings.

avatar tonypartridge
tonypartridge - comment - 13 Feb 2019

There is no need to read code? If you use an IDE run an inspection for php deprecated classes and it will tell you everything you are using that is deprecated and should be updated.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Ninja-007 notifications@github.com
Sent: Wednesday, February 13, 2019 2:58 pm
To: joomla/joomla-cms
Cc: Tony Partridge; Mention
Subject: Re: [joomla/joomla-cms] [J4 Doc] Looking for Joomla 4 extension development document (#23376)

Backward compatibility of J4 to J3 extensions is a Legacy mode for me. I have my own extensions and some third party extensions. My extensions should be in J4 architecture and NOT J3 compatible. They should use namespaces, new event system, new classe names etc.

So I my question was, instead of reading code of my extensions (developed by someone in the team) which it time consuming, it would be great to have some simple way to disable B/C compatibility in J4 for a particular extension and see see UI errors/warnings.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub#23376 (comment), or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABVglkAGMTlqy82IHewkPDyUzk98kMGfks5vNCgngaJpZM4ZkPr2.

avatar mbabker
mbabker - comment - 13 Feb 2019

There is not a "legacy mode", there is not a configuration option to disable "legacy" code or backward compatibility or raise warnings because a specific class is in use. The long and short is if a class is not deprecated, it is just fine to use it. If a class is deprecated (which depending on the convention in use may trigger a E_USER_DEPRECATED message in your PHP logs or a Log::WARNING level message in a Joomla log subscribed to the "deprecated" category), you should replace its use by whatever is suggested (if something says it is deprecated without replacement then core is not going to offer that specific thing anymore).

There is not documentation right now on building extensions using only systems introduced in 4.0. And looking at the current API, "legacy" code to support backward compatibility is not deprecated. So it is perfectly acceptable to continue using 3.x best practices in code written for 4.0 until that convention is deprecated and removed. If you're looking for examples on how to migrate, I would suggest looking over the pull requests toward the 4.0 branch as most components were migrated to not use the legacy dispatcher, I know I've updated one plugin to demonstrate the newer API, and I want to say that there's a patch out there for moving modules to a dispatcher but I'm not sure on this one.

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar alex7r
alex7r - comment - 23 Mar 2019

@tonypartridge you can not rely on IDE inspections with Joomla, as there is lot's of things triggering notices. I would also be more specific and would say that there is a lot of deprecated syntax (or "deprecated call", I'm not sure) for years, when you can call function with the new syntax, but it still raise the inspection warning just to let you know that there is a planned removal of the old syntax.
So IDE inspections are not working (at least as I would expect those to).

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2019

@Ninja-007 is this Issue solved?

avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Title
[J4 Doc] Looking for Joomla 4 extension development document
[4.0] Looking for Joomla 4 extension development document
Status Discussion Information Required
avatar joomla-cms-bot joomla-cms-bot - edited - 28 Mar 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Category Documentation
avatar NickSdot
NickSdot - comment - 29 Mar 2019

I hope that this is not a stupid question, so I try my luck. :-D

As far as I understood it right J! 3.9 already have all the relevant libraries for J!4 included.

What I wonder about is whether or not it is possible to use the new J!4 component design patterns in J!3.9 already? Let's say I copy all com_banner files & database tables in a J!3.9 installation. Can I tell Joomla! to use the new way?

Of course that's just an example.
What I actually wonder about is if I can use the old and new 'way' in the same time.

This would make it much easier to migrate view by view to the new way, instead of maintaining two versions in the same time. For example, if I want to add a new view to my component now. Why should I use the J!3 way if I could create it in the J!4 way with some switches!?

Of course I am aware of issues like different bootstrap versions, html structure and so on. The question is meant in general.

So, again, in short: Can I tell J!3.9 to use the new file/folder/db structure for specific components?

avatar Ninja-007
Ninja-007 - comment - 29 Mar 2019

@Ninja-007 is this Issue solved?

Yes the issue is no longer important for me. But there will be J4 early adapters who will look for some documentation. They may ask questions here.

avatar franz-wohlkoenig franz-wohlkoenig - change - 29 Mar 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-03-29 06:22:18
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 29 Mar 2019
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 29 Mar 2019
avatar joomla-cms-bot
joomla-cms-bot - comment - 29 Mar 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 29 Mar 2019

@Ninja-007 Thanks for Answer. I will close it, if Release Lead like to have Comments about Documentation here he will reopen.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23376.

Add a Comment

Login with GitHub to post a comment