Upgrading Extensions and Plugins to use "new methodology"

For Joomla! 5.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Wed Apr 10, 2024 11:08 am

Hi

I have a plug in which shows a kml file using google maps and an extension showing a facebook page.

Of course if I turn the Behaviour - Backward Compatibility off then lots and lots of things go belly up !

Are there any instructions as to what changes have to be made ?
I am unable to find anything at all. I cannot even find where this extension is located ?

All of my code and files etc are here: https://tdocplus.co.uk/0a_Empty400/face-book
and
https://tdocplus.co.uk/0a_Empty400/kml- ... e-map-code

There does not seem to be anything published that after two hours on google and the forum that I can find. Probably looking for the wrong words !

I want a SIMPLE step by step instruction - is that too much to ask ?

Richard

robbiej
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Wed Apr 06, 2016 11:22 am

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by robbiej » Fri Apr 12, 2024 6:41 pm

Some significant new concepts were introduced in Joomla 4 and although these aspects make the code more flexible and easier to maintain, there is a threshold to get over in terms of understanding them and converting your extension code. Unfortunately it's not

I would suggest you have a look at https://docs.joomla.org/J3.x:Developing ... to_Joomla4 where it gives a description of what's involved in converting a component, and there are associated videos. You've probably got modules and plugins instead of a component, but the concepts do apply to those types of extensions as well.

The concepts are described at https://manual.joomla.org/docs/general-concepts/ - probably the ones which will affect you most are Namespacing, Extension & Dispatcher, Dependency Injection and Web Asset Manager.

There is also some information about building plugins in the "new methodology" under https://manual.joomla.org/docs/building ... s/plugins/

The equivalent section for modules should hopefully be available within a couple of months.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Fri Apr 12, 2024 7:44 pm

Hi

Thanks for the links.

"This page is unfinished, please use the Edit this Page link at the bottom of this page to help make it more useful."

Yup I agree

Is it time to dump Joomla in favour of Word Press ?

The Community need to come up and support us

Richard

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2694
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by ceford » Sat Apr 13, 2024 6:54 am


rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Sat Apr 13, 2024 9:38 am

Hi
Thanks for that link.
Its the 4 to 5 changes that have me stumped.
I wrote my plugin in and extension for J 4 and then found they worked 100 % for J3 !
Richard

MarkRS
Joomla! Explorer
Joomla! Explorer
Posts: 345
Joined: Thu Oct 29, 2009 8:28 am
Location: UK

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by MarkRS » Sat Apr 13, 2024 1:44 pm

If you give specific examples it would be easier to help.

You can still write old-style code and it will work in J4, so that's not really a yardstick.
It's a community, the more we all contribute, the better it will be.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Sat Apr 13, 2024 1:59 pm

Hi

Please see here: https://tdocplus.co.uk/0a_Empty400/face-book

Scroll to: Structure of "mod_tdocfbk"

What do I have to change here ? The Update and the Language seem to be ok !

In the "root" directory:
index.html
helper.php
mod_tdocfbk.php
mod_tdocfbk.xml
In the "tmpl" sub-directory
index.html
default.php

And then any mods to the files especially mod_tdocfbk.xml [root]

Richard

MarkRS
Joomla! Explorer
Joomla! Explorer
Posts: 345
Joined: Thu Oct 29, 2009 8:28 am
Location: UK

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by MarkRS » Sat Apr 13, 2024 2:36 pm

If you're having a specific problem somewhere, say exactly where, and what.

Call me lazy if you like, bit while I, and many others, am happy to help I do have my own work/life going on, so making it easy to help will probably get you more help.
It's a community, the more we all contribute, the better it will be.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Sat Apr 13, 2024 2:39 pm

Mark RS

And that is exactly the problem !

I need to know what the new "constructs" are.

You can probably use the mark 1 eyeball and say there, there and there .

At 77 I am now bewildered with the undocumented changes.

Richard

MarkRS
Joomla! Explorer
Joomla! Explorer
Posts: 345
Joined: Thu Oct 29, 2009 8:28 am
Location: UK

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by MarkRS » Sat Apr 13, 2024 3:44 pm

The main thing I notice is that you're still using the early J3 directory structure.
Move your "helper.php" into a directory src/helper underneath the root. It would be good to use namespacing, it isolates your code from anything else that happens to have the same name.

Create a "forms" directory under your root and put your xml form file in it.

Do look at Robbie's excellent J3-with-J4-changes documents that he refers to above.
It's a community, the more we all contribute, the better it will be.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Sat Apr 13, 2024 6:07 pm

Hi all

Thanks for the info
viz: Joomla! Programmers Documentation for Joomla 5.0

It seems I have a lot of learning to do to get a small php file to run - all it does is run a small script which displays a facebook page !

R

robbiej
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Wed Apr 06, 2016 11:22 am

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by robbiej » Sun Apr 14, 2024 2:36 pm

Yeah, I sympathise with you about the lack of documentation; I have in mind to write a description of what you have to do to upgrade a module - I just haven't got round to it yet.

However, if you point me to a zip file for your module and work out a way of communicating directly between us then I'll sort out the code changes for you.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Mon Apr 22, 2024 11:15 am

Robbie
There are two and you can download them from the Joomla Extensions Directory - keyword to find then is simply TDOC.
Attached anyway
[email protected]
You do not have the required permissions to view the files attached to this post.

robbiej
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Wed Apr 06, 2016 11:22 am

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by robbiej » Thu Apr 25, 2024 8:52 pm

I've updated the gmap plugin at https://drive.google.com/file/d/13771Pm ... drive_link

I've updated it to use more recent Joomla mechanisms - see https://manual.joomla.org/docs/building ... ent-plugin for a plugin similar to yours.

However, I think it would have been ok at Joomla 5 at least.

You should really check the application context (site / administrator / api) in the plugin (which I've added) and also the context (eg "com_content.article") (which I haven't added), as onContentPrepare gets triggered in different application contexts and by different components (eg com_contact as well).

The updated module is at https://drive.google.com/file/d/1Eelh8z ... drive_link
To avoid compatibility problems I think you just needed to replace JFactory by its namespaced equivalent. These mappings are in the classmap.php file:

In libraries/classmap.php in Joomla 4

In plugins/behaviour/compat/src/classmap/classmap.php in Joomla 5

I've added the module namespacing to the helper file, but you don't really need this as you never call it.

At some point you should move to using the Web Asset Manager for managing your js code. I'm going to update the basic module tutorial and include how to do that - should be available at https://manual.joomla.org/docs/building ... s/modules/ shortly.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Fri Apr 26, 2024 8:52 am

Robbie

Thanks for the mods . . . which I will examine carefully.

I am a "minimalist" when it comes to coding and web sites. My software TDOC started in "dbase", got "clippered" and then "windowed" using CA Visual Objects, and it is still in use today - last build was in 2020 !

I developed the two extensions because I could not find anything on JED to replace what I was using.

It seemed obvious to publish what I had written. Documented in detail on https://tdocplus.co.uk/0a_Empty400/ mainly for my own records ! So I will update that as well.

I am now approaching 77 - and am not contemplating doing things for much longer . . . my original java script site still works well - tdoc.net.

Anyway, thanks a million . . .

Richard

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Sat Apr 27, 2024 2:28 pm

Robbie

Am starting to test the new version of the Facebook Module.

So the new version will only be for J5 . . .

So the mod_tdocfbk_update.xml needs to be updated.

So I guess this line needs to be
<targetplatform name="joomla" version="5.*"/> [was version=".*"]
and while I am at it:
<php_minimum>8.1</php_minimum> [was 7.2]

Richard

robbiej
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Wed Apr 06, 2016 11:22 am

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by robbiej » Thu May 02, 2024 7:13 pm

Hi Richard,

Yes, I think that might be the minimum php for Joomla 5.

I'm working my way through documenting the module tutorial, so it's not yet merged into the joomla manual, but you can find the step that handles supporting javascript at http://pr-261.manual.joomlacode.org/doc ... javascript (make sure that version 4.4 is selected).

The joomla web asset manager makes life so much easier, so it's worth giving it a try.

So I've got nearly 10 years more of coding before I reach your stage!

Robbie

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2921
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by SharkyKZ » Thu May 02, 2024 7:34 pm

robbiej wrote:
Thu May 02, 2024 7:13 pm
Hi Richard,

Yes, I think that might be the minimum php for Joomla 5.

I'm working my way through documenting the module tutorial, so it's not yet merged into the joomla manual, but you can find the step that handles supporting javascript at http://pr-261.manual.joomlacode.org/doc ... javascript (make sure that version 4.4 is selected).

The joomla web asset manager makes life so much easier, so it's worth giving it a try.

So I've got nearly 10 years more of coding before I reach your stage!

Robbie
That's not really a modern module. Like other extensions, modules should have a service provider.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Fri May 03, 2024 8:10 am

SharkyKZ

You say that: modules should have a service provider.

Both Facebook and Google Maps provide the "service" by way of parsing the scripts etc.

Where can I find out more about this concept, and what should it contain ?

Richard

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2694
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by ceford » Fri May 03, 2024 10:55 am

In this article: https://www.dionysopoulos.me/book.html - scroll down to the Modules section and you will see a section entitled Service Provider.

rgtr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Tue Sep 01, 2009 11:31 am
Location: Glasgow
Contact:

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by rgtr » Fri May 03, 2024 11:12 am

ceford
Thanks for that . . .
At 77, I am getting near the stage of not wanting to be bothered . . .
Robbiej has done a splendid job tweaking my code - but I simply do not understand it !
Richard

User avatar
carlitorweb
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Tue May 08, 2018 9:03 pm

Re: Upgrading Extensions and Plugins to use "new methodology"

Post by carlitorweb » Fri May 03, 2024 5:34 pm

rgtr wrote:
Fri May 03, 2024 11:12 am
ceford
Thanks for that . . .
At 77, I am getting near the stage of not wanting to be bothered . . .
Robbiej has done a splendid job tweaking my code - but I simply do not understand it !
Richard
Is good enough to take a look to a module in the Joomla core, to easy figure out how the new structure work. Plus, read some documentation you already got by others here, will exaplin you those part you still not understand. You cant upgrade your code without read how work for next version.
Calm, happy and humble person, I like to optimize everything and solve problems (if possible by remaining simple). Proactive in my work and within my family.


Post Reply

Return to “Joomla! 5.x Coding”