diff --git a/administrator/components/com_modules/tmpl/module/edit.php b/administrator/components/com_modules/tmpl/module/edit.php index f0f04801f40bf..9ff59422a7351 100644 --- a/administrator/components/com_modules/tmpl/module/edit.php +++ b/administrator/components/com_modules/tmpl/module/edit.php @@ -18,8 +18,6 @@ /** @var \Joomla\Component\Modules\Administrator\View\Module\HtmlView $this */ -HTMLHelper::_('behavior.combobox'); - $hasContent = isset($this->item->xml->customContent); $hasContentFieldName = 'content'; @@ -39,10 +37,10 @@ $this->getDocument()->addScriptOptions('module-edit', ['itemId' => $this->item->id, 'state' => (int) $this->item->id == 0 ? 'Add' : 'Edit']); -/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ -$wa = $this->getDocument()->getWebAssetManager(); -$wa->useScript('keepalive') - ->useScript('form.validate'); +$this->getDocument()->getWebAssetManager() + ->useScript('keepalive') + ->useScript('form.validate') + ->useScript('awesomplete'); $input = Factory::getApplication()->getInput(); diff --git a/administrator/components/com_templates/tmpl/template/default.php b/administrator/components/com_templates/tmpl/template/default.php index 99833432dd2ee..410f9ea12a827 100644 --- a/administrator/components/com_templates/tmpl/template/default.php +++ b/administrator/components/com_templates/tmpl/template/default.php @@ -21,16 +21,21 @@ /** @var \Joomla\Component\Templates\Administrator\View\Template\HtmlView $this */ -HTMLHelper::_('behavior.multiselect', 'updateForm'); -HTMLHelper::_('bootstrap.modal'); +$app = Factory::getApplication(); +$doc = $app->getDocument(); + +// Pass the required options to the javascript +$doc->addScriptOptions('js-multiselect', ['formName' => 'updateForm']); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ -$wa = $this->getDocument()->getWebAssetManager(); -$input = Factory::getApplication()->getInput(); +$wa = $doc->getWebAssetManager(); +$input = $app->getInput(); // Enable assets $wa->useScript('form.validate') ->useScript('keepalive') + ->useScript('bootstrap.modal') + ->useScript('multiselect') ->useScript('com_templates.admin-template-toggle-switch') ->useScript('com_templates.admin-templates') ->useStyle('com_templates.admin-templates'); diff --git a/components/com_config/tmpl/modules/default.php b/components/com_config/tmpl/modules/default.php index d8cd0a117d3e8..c9be9c837d35e 100644 --- a/components/com_config/tmpl/modules/default.php +++ b/components/com_config/tmpl/modules/default.php @@ -10,19 +10,17 @@ defined('_JEXEC') or die; -use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; -HTMLHelper::_('behavior.combobox'); - /** @var \Joomla\Component\Config\Site\View\Modules\HtmlView $this */ -/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ -$wa = $this->getDocument()->getWebAssetManager(); -$wa->useScript('keepalive') + +$this->getDocument()->getWebAssetManager() + ->useScript('keepalive') ->useScript('form.validate') - ->useScript('com_config.modules'); + ->useScript('com_config.modules') + ->useScript('awesomplete'); $editorText = false; $moduleXml = JPATH_SITE . '/modules/' . $this->item['module'] . '/' . $this->item['module'] . '.xml'; diff --git a/layouts/joomla/form/field/combo.php b/layouts/joomla/form/field/combo.php index 86f52cee67e07..b710201c388fb 100644 --- a/layouts/joomla/form/field/combo.php +++ b/layouts/joomla/form/field/combo.php @@ -12,7 +12,7 @@ extract($displayData); -use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; /** * Layout variables @@ -45,7 +45,7 @@ * @var array $dataAttributes Miscellaneous data attribute for eg, data-*. */ -HTMLHelper::_('behavior.combobox'); +Factory::getApplication()->getDocument()->getWebAssetManager()->usePreset('awesomplete'); $attr = ''; diff --git a/libraries/src/HTML/Helpers/Grid.php b/libraries/src/HTML/Helpers/Grid.php index 44ac0fad85200..d7fe135478dde 100644 --- a/libraries/src/HTML/Helpers/Grid.php +++ b/libraries/src/HTML/Helpers/Grid.php @@ -89,7 +89,7 @@ public static function sort($title, $order, $direction = 'asc', $selected = '', */ public static function checkall($name = 'checkall-toggle', $action = 'Joomla.checkAll(this)') { - HTMLHelper::_('behavior.core'); + Factory::getApplication()->getDocument()->getWebAssetManager()->useScript('core'); return ''; } diff --git a/libraries/src/Language/Text.php b/libraries/src/Language/Text.php index 15af9680d16ab..a77040333dc28 100644 --- a/libraries/src/Language/Text.php +++ b/libraries/src/Language/Text.php @@ -10,7 +10,6 @@ namespace Joomla\CMS\Language; use Joomla\CMS\Factory; -use Joomla\CMS\HTML\HTMLHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -351,7 +350,8 @@ public static function script($string = null, $jsSafe = false, $interpretBackSla // Add the string to the array if not null. if ($string !== null) { - $doc = Factory::getDocument(); + $app = Factory::getApplication(); + $doc = $app->getDocument(); // Get previously added strings $strings = $doc->getScriptOptions('joomla.jtext'); @@ -362,7 +362,7 @@ public static function script($string = null, $jsSafe = false, $interpretBackSla static::$strings[$key] = $strings[$key]; // Load core.js dependency - HTMLHelper::_('behavior.core'); + $doc->getWebAssetManager()->useScript('core'); // Update Joomla.Text script options $doc->addScriptOptions('joomla.jtext', $strings, false);