diff --git a/build/media/legacy/joomla.asset.json b/build/media/legacy/joomla.asset.json index 3a8ea5875373f..094b8d289aa24 100644 --- a/build/media/legacy/joomla.asset.json +++ b/build/media/legacy/joomla.asset.json @@ -12,6 +12,24 @@ "js": [ "media/legacy/js/jquery-noconflict.min.js" ] + }, + "jquery.ui.core": { + "name": "jquery.ui.core", + "dependencies": [ + "jquery" + ], + "js": [ + "media/vendor/jquery-ui/js/jquery.ui.core.js" + ] + }, + "jquery.ui.sortable": { + "name": "jquery.ui.sortable", + "dependencies": [ + "jquery.ui.core" + ], + "js": [ + "media/vendor/jquery-ui/js/jquery.ui.sortable.js" + ] } } } diff --git a/build/media_src/system/joomla.asset.json b/build/media_src/system/joomla.asset.json index 017321869e31d..a2b3c9b371780 100644 --- a/build/media_src/system/joomla.asset.json +++ b/build/media_src/system/joomla.asset.json @@ -35,6 +35,9 @@ ], "js": [ "media/system/js/searchtools.min.js" + ], + "css": [ + "system/searchtools.css" ] }, "showon": { diff --git a/libraries/cms/html/jquery.php b/libraries/cms/html/jquery.php index e82d312193081..3a3473fcdf05d 100644 --- a/libraries/cms/html/jquery.php +++ b/libraries/cms/html/jquery.php @@ -39,37 +39,26 @@ abstract class JHtmlJquery * @return void * * @since 3.0 + * + * @deprecated 5.0 Use Joomla\CMS\WebAsset\WebAssetRegistry::enableAsset(); */ public static function framework($noConflict = true, $debug = null, $migrate = false) { - // Only load once - if (!empty(static::$loaded[__METHOD__])) - { - return; - } - - // If no debugging value is set, use the configuration setting - if ($debug === null) - { - $debug = (boolean) Factory::getApplication()->get('debug'); - } - - HTMLHelper::_('script', 'vendor/jquery/jquery.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); + $wa = Factory::getApplication()->getDocument()->getWebAssetManager(); + $wa->enableAsset('jquery'); // Check if we are loading in noConflict if ($noConflict) { - HTMLHelper::_('script', 'legacy/jquery-noconflict.min.js', array('version' => 'auto', 'relative' => true)); + $wa->enableAsset('jquery-noconflict'); } // Check if we are loading Migrate if ($migrate) { - HTMLHelper::_('script', 'vendor/jquery-migrate/jquery-migrate.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); + $wa->enableAsset('jquery-migrate'); } - static::$loaded[__METHOD__] = true; - return; } @@ -84,38 +73,21 @@ public static function framework($noConflict = true, $debug = null, $migrate = f * @return void * * @since 3.0 + * + * @deprecated 5.0 Use Joomla\CMS\WebAsset\WebAssetRegistry::enableAsset(); */ public static function ui(array $components = array('core'), $debug = null) { // Set an array containing the supported jQuery UI components handled by this method $supported = array('core', 'sortable'); - // Include jQuery - static::framework(); - - // If no debugging value is set, use the configuration setting - if ($debug === null) - { - $debug = JDEBUG; - } + $wa = Factory::getApplication()->getDocument()->getWebAssetManager(); - // Load each of the requested components foreach ($components as $component) { - // Only attempt to load the component if it's supported in core and hasn't already been loaded - if (in_array($component, $supported) && empty(static::$loaded[__METHOD__][$component])) + if (in_array($component, $supported)) { - HTMLHelper::_( - 'script', - 'vendor/jquery-ui/jquery.ui.' . $component . '.min.js', - array( - 'version' => 'auto', - 'relative' => true, - 'detectDebug' => $debug, - ) - ); - - static::$loaded[__METHOD__][$component] = true; + $wa->enableAsset('jquery.ui.' . $component); } } diff --git a/libraries/cms/html/searchtools.php b/libraries/cms/html/searchtools.php index 1b47897acab40..403b689cbb76c 100644 --- a/libraries/cms/html/searchtools.php +++ b/libraries/cms/html/searchtools.php @@ -51,9 +51,7 @@ public static function form($selector = '.js-stools-form', $options = array()) $options = static::optionsToRegistry($options); // Load the script && css files - HTMLHelper::_('behavior.core'); - HTMLHelper::_('script', 'system/searchtools.min.js', array('version' => 'auto', 'relative' => true)); - HTMLHelper::_('stylesheet', 'system/searchtools.css', array('version' => 'auto', 'relative' => true)); + Factory::getApplication()->getDocument()->getWebAssetManager()->enableAsset('searchtools'); Factory::getDocument()->addScriptOptions('searchtools', $options);