Upgrading a Joomla! 2.5 component to make it Joomla! 3 compatible
If anyone has told you that all you need to do to upgrade an extension from Joomla! 2.5 to Joomla! 3 is do a find-and-replace for the new legacy classes, then they were lying, or didn't know what they were talking about. This may be true for very simple extensions that are already following best practices, but in reality there is a lot more work involved. There were a number of functions that were deprecated or changed, and with the introduction of Bootstrap, the backend interface has undergone some significant changes. So to make the extension work well on Joomla! 3, there is a bit of work involved.
The following section details a lot of the changes you will need to make to get your extension working in Joomla! 3:
Some of the changes are quite subtle, such as changing the nameQuote
to QuoteName
, but some require a bit more work than just finding and replacing, such as the changes from getTableFields
to getTableColumns
. One change I'd like to highlight is the removal of DS
that was commonly used for the directory slashes in previous Joomla! versions. Now you should use /
instead. For example, JPATH_COMPONENT.DS.'controller.php'
would now be written as JPATH_COMPONENT.'/controller.php'
. Although you could define a DS
constant to avoid having to change your code, I would recommend that you make the effort and update your code.
For plugins and modules, this is probably all you need to do to them and they will work, but for components it is not quite that easy. Even after you've made all these changes, although your extension may work in Joomla! 3, it may not look very pretty. You will see an example of this in the following screenshot, where there are unnecessary bullet points and a field that is only partially showing:
Since Joomla! 3 now uses Bootstrap and is mobile-ready, there is a bit of work required to make the extension look and behave like the core extensions, as there are a number of visual changes such as the introduction of tabs. All the detailed changes necessary to convert a Joomla! 2.5 component to a fully Joomla! 3 native component are outside the scope of this book, but you will be able to compare your code to our Joomla! 3 examples to get an idea of what you need to change, or you could also have a look at com_weblinks
. The following screenshot shows the same form as shown in the previous screenshot, however this one has been fully updated to support Joomla! 3: