Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions build/media/legacy/joomla.asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
}
3 changes: 3 additions & 0 deletions build/media_src/system/joomla.asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
],
"js": [
"media/system/js/searchtools.min.js"
],
"css": [
"system/searchtools.css"
]
},
"showon": {
Expand Down
50 changes: 11 additions & 39 deletions libraries/cms/html/jquery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
}
}

Expand Down
4 changes: 1 addition & 3 deletions libraries/cms/html/searchtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down