3

To whom it may concern: I just installed joomla 4.0 alpha and installed a custom extension of mine there in which uses mootools (JHTML::_('behavior.modal');), but it simply does not work. is there another library for mootools with a different syntax in this new version of joomla? Kian William

3

In Joomla 4 we've completely removed the Mootools library and any API functions for it. If you'd like to utilise a modal, you can use JHtmlBootstrap::renderModal which is currently a wrapper for Bootstraps JS modal component, however we're rewriting the main components as custom elements.

Here is an example for you to build on top of:

// Add this to the top of your PHP file
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

// Render Modal
echo HTMLHelper::_(
    'bootstrap.renderModal',
    'versionsModal',
    array(
        'url'        => 'URL',
        'title'      => 'Modal title here',
        'height'     => '400px',
        'width'      => '800px',
        'modalWidth' => 80,
        'bodyHeight' => 60,
        'footer'     => '<a type="button" class="btn btn-secondary" data-dismiss="modal">' . Text::_('JCANCEL') . '</a>'
    )
);
  • I guessed that, also I thought the syntax of usage might be changed, I can add the mootool library myself to my custom extension to make it work then, can't I? any side effect? And also what was wrong with mootools to be removed from joomla 4 alpha? The more libraries for a CMS, make it more public! – Kian William Nowrouzian Jan 29 '18 at 4:41
  • That's not the way it works. Mootools is very old and there's absolutely no need for it. We're also rewriting all jQuery in vanilla JS and ensuring jQuery wont be loaded in core (you'll still be able to use it though). We are moving to custom elements, which are much faster, framework agnostic, and will also be fully accessible. Libraries like Mootools amd jQuery are slow and dying. Let's move forward with the times – Lodder Jan 29 '18 at 9:05
  • following your answer, I contacted mootools forum, jquery forum too, they are active, specially jquery, ofcourse angularJs , vue.js and as you kindly said VanillaJS are active too, specially angular and vue are on top in 2018, Modern Browsers with their advanced css handling will have an impact on all frameworks of js not only on jquery but on all frameworks of js. – Kian William Nowrouzian Jan 30 '18 at 7:48
  • jQuery is of course still active, but not as much as it used to be. They're working on v4 however have not released an update in about 8 months. Libraries like jQuery were originally created to cater for browser differenes, but now that most developers only work with IE11+, there's no need for jQuery. Hence why UI frameworks such as UIKit and Bootstrap have already, or are in the process of moving away from jQuery. Angular and Vue are completely different, but we are using Vue for the Joomla 4 Media Manager. – Lodder Jan 30 '18 at 8:17
  • Yes, I have IE11 and when I develop a site or custom extension I check it there too, not all its features are the same with Chrome, FF, Opera and safari. If a developer only develops the website or extension based on IE11 features, there might be problems with other browsers and not all companies use IE11 browser to view websites. I am positive other browsers will be developed to their most extent so that css shall be the mainspring of all dynamic features of a website, and this will include even angular and vue. – Kian William Nowrouzian Jan 31 '18 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.