-
Notifications
You must be signed in to change notification settings - Fork 42
Migrating to v2.4x
Astroid v2.4.x
released with some major changes in the entire project and a large section of users are facing a lot of breaks on their website. Especially those users who ever edited the files of the TEMPLATE_PATH/html/frontend
folder.
With v2.4.x
, we aim to have no dependencies on template level and also have no breaking changes. However, things don’t always go as planned.
The reason for so many breaks, is major rewrite in the core library of Astroid, which was very important to keep in mind the future of framework. Here are some most important changes are summarized below that you should be aware while moving from v2.3.x
to v2.4.x
.
-
As all the dependencies have been moved from the template to the framework level, then we do not need some of these things, if we have not written some custom code in it. Also, Joomdev has release all of its templates with Astroid
2.4.x
compatibility. You can also update your Astroid based template using folllowing steps.- Remove
astroid
andbootstrap
folders fromscss
- Remove
@import
ofastroid
andbootstrap
and dependencies fromstyle.scss
- Move
frontend
folder tohtml/frontend
- Remove files from
frontend
folder those never customized or edited. -
Change
index.php
code. - Template folder structure.
- Remove
options
folder fromastroid
folder - Remove
vendor
,jui
folders andscript.js
file fromjs
folder
- Remove
-
-
If you are using following classes
AstroidFramework
,AstroidFrameworkTemplate
,AstroidFrameworkHelper
,AstroidFrameworkConstants
,AstroidMenu
in your code then you must update these library code before getting completely depriciate. See Using Astroid\Framework -
All following
jimport
are depriciated.jimport('astroid.framework.astroid'); jimport('astroid.framework.menu'); jimport('astroid.framework.template'); jimport('astroid.framework.helper'); jimport('astroid.framework.constants');
Use below code instead:
use Astroid\Framework; // using namespace $template = Framework::getTemplate(); $document = Framework::getDocument();
-
Getting Template Params
In frontend folder, Old code:
$value = $template->params->get('variable', 'default');
New Code:
$template = Astroid\Framework::getTemplate(); $params = $template->getParams(); $value = $pamams->get('variable', 'default');
-
Loading sublayout
Old Way:
jimport('astroid.framework.template'); $template = new AstroidFrameworkTemplate(); $template->loadLayout('header.sticky', true);
New Way:
use Astroid\Framework; $document = Framework::getDocument(); $document->include('header.sticky');
-
Using Menu
Old code:
jimport('astroid.framework.menu'); AstroidMenu::getMenu(ARGUMENTS);
New code:
use Astroid\Component\Menu; Menu::getMenu(ARGUMENTS);
-
NOTE: This document is still in progress. Please be in touch to stay updated.