diff --git a/administrator/templates/atum/component.php b/administrator/templates/atum/component.php index 10abf402ea44f..4cde3ad00cf7f 100644 --- a/administrator/templates/atum/component.php +++ b/administrator/templates/atum/component.php @@ -16,9 +16,6 @@ $lang = Factory::getLanguage(); -// Alerts -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); - // Add JavaScript Frameworks HTMLHelper::_('bootstrap.framework'); HTMLHelper::_('script', 'vendor/focus-visible/focus-visible.min.js', ['version' => 'auto', 'relative' => true]); diff --git a/administrator/templates/atum/error_full.php b/administrator/templates/atum/error_full.php index fbbb996a4dd4c..82c91e00a6d0b 100644 --- a/administrator/templates/atum/error_full.php +++ b/administrator/templates/atum/error_full.php @@ -43,9 +43,6 @@ // Load custom CSS file HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true)); -// Alerts -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); - // Load specific language related CSS HTMLHelper::_('stylesheet', 'administrator/language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto')); diff --git a/administrator/templates/atum/error_login.php b/administrator/templates/atum/error_login.php index 12b6057f3f364..580991ec1db74 100644 --- a/administrator/templates/atum/error_login.php +++ b/administrator/templates/atum/error_login.php @@ -30,10 +30,6 @@ HTMLHelper::_('stylesheet', 'font-awesome.min.css', ['version' => 'auto', 'relative' => true]); HTMLHelper::_('stylesheet', 'template' . ($this->direction === 'rtl' ? '-rtl' : '') . '.min.css', ['version' => 'auto', 'relative' => true]); -// Alerts -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto']); - - // Load custom CSS file HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true)); diff --git a/administrator/templates/atum/index.php b/administrator/templates/atum/index.php index fb37346fb5f01..8cc5f3d2f985a 100644 --- a/administrator/templates/atum/index.php +++ b/administrator/templates/atum/index.php @@ -35,17 +35,16 @@ HTMLHelper::_('bootstrap.framework'); HTMLHelper::_('script', 'vendor/focus-visible/focus-visible.min.js', ['version' => 'auto', 'relative' => true]); -// Load template CSS file +// Load the dependencies CSS files HTMLHelper::_('stylesheet', 'bootstrap.css', ['version' => 'auto', 'relative' => true]); HTMLHelper::_('stylesheet', 'font-awesome.css', ['version' => 'auto', 'relative' => true]); + +// Load the template CSS file HTMLHelper::_('stylesheet', 'template' . ($this->direction === 'rtl' ? '-rtl' : '') . '.css', ['version' => 'auto', 'relative' => true]); // Load custom CSS file HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true)); -// Alerts -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); - // Load specific language related CSS HTMLHelper::_('stylesheet', 'administrator/language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto')); diff --git a/administrator/templates/atum/login.php b/administrator/templates/atum/login.php index 10feec121d8d7..da73595c15e66 100644 --- a/administrator/templates/atum/login.php +++ b/administrator/templates/atum/login.php @@ -27,10 +27,6 @@ HTMLHelper::_('stylesheet', 'font-awesome.css', ['version' => 'auto', 'relative' => true]); HTMLHelper::_('stylesheet', 'template' . ($this->direction === 'rtl' ? '-rtl' : '') . '.css', ['version' => 'auto', 'relative' => true]); -// Alerts -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto']); - - // Load custom CSS file HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true)); diff --git a/layouts/joomla/system/message.php b/layouts/joomla/system/message.php index 7f08d6c5f2735..0154a0fc49019 100644 --- a/layouts/joomla/system/message.php +++ b/layouts/joomla/system/message.php @@ -10,6 +10,7 @@ defined('JPATH_BASE') or die; use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; $msgList = $displayData['msgList']; @@ -26,6 +27,8 @@ 'message' => 'success' ]; +// Alerts progressive enhancement +HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); ?>
diff --git a/libraries/src/Document/HtmlDocument.php b/libraries/src/Document/HtmlDocument.php index b524c5346ddf7..e0fbb6aa463f0 100644 --- a/libraries/src/Document/HtmlDocument.php +++ b/libraries/src/Document/HtmlDocument.php @@ -749,8 +749,9 @@ protected function _parseTemplate() if (preg_match_all('##iU', $this->_template, $matches)) { - $template_tags_first = array(); - $template_tags_last = array(); + $messages = []; + $template_tags_first = []; + $template_tags_last = []; // Step through the jdocs in reverse order. for ($i = count($matches[0]) - 1; $i >= 0; $i--) @@ -760,20 +761,21 @@ protected function _parseTemplate() $name = $attribs['name'] ?? null; // Separate buffers to be executed first and last - if ($type == 'module' || $type == 'modules') + if ($type === 'module' || $type === 'modules') { - $template_tags_first[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'attribs' => $attribs); + $template_tags_first[$matches[0][$i]] = ['type' => $type, 'name' => $name, 'attribs' => $attribs]; + } + elseif ($type === 'message') + { + $messages = [$matches[0][$i] => ['type' => $type, 'name' => $name, 'attribs' => $attribs]]; } else { - $template_tags_last[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'attribs' => $attribs); + $template_tags_last[$matches[0][$i]] = ['type' => $type, 'name' => $name, 'attribs' => $attribs]; } } - // Reverse the last array so the jdocs are in forward order. - $template_tags_last = array_reverse($template_tags_last); - - $this->_template_tags = $template_tags_first + $template_tags_last; + $this->_template_tags = $template_tags_first + $messages + array_reverse($template_tags_last); } return $this; @@ -788,8 +790,8 @@ protected function _parseTemplate() */ protected function _renderTemplate() { - $replace = array(); - $with = array(); + $replace = []; + $with = []; foreach ($this->_template_tags as $jdoc => $args) { diff --git a/templates/cassiopeia/error.php b/templates/cassiopeia/error.php index cd4109010d070..20155b50ede58 100644 --- a/templates/cassiopeia/error.php +++ b/templates/cassiopeia/error.php @@ -44,9 +44,6 @@ // Load custom CSS file HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true)); -// Alerts progressive enhancement -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); - // Load specific language related CSS HTMLHelper::_('stylesheet', 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto')); diff --git a/templates/cassiopeia/index.php b/templates/cassiopeia/index.php index 348401ebd17f9..fbbf14a587ea7 100644 --- a/templates/cassiopeia/index.php +++ b/templates/cassiopeia/index.php @@ -44,9 +44,6 @@ // Load custom CSS file HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true)); -// Alerts progressive enhancement -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); - // Load specific language related CSS HTMLHelper::_('stylesheet', 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto')); diff --git a/templates/cassiopeia/offline.php b/templates/cassiopeia/offline.php index d379177ab4325..6540eefde2613 100644 --- a/templates/cassiopeia/offline.php +++ b/templates/cassiopeia/offline.php @@ -26,16 +26,10 @@ // Add JavaScript Frameworks HTMLHelper::_('behavior.core'); -// Add template js -HTMLHelper::_('script', 'template.js', ['version' => 'auto', 'relative' => true]); - // Add Stylesheets HTMLHelper::_('stylesheet', 'template.css', ['version' => 'auto', 'relative' => true]); HTMLHelper::_('stylesheet', 'offline.css', ['version' => 'auto', 'relative' => true]); -// Alerts progressive enhancement -HTMLHelper::_('webcomponent', 'vendor/joomla-custom-elements/joomla-alert.min.js', ['relative' => true, 'version' => 'auto', 'detectBrowser' => false, 'detectDebug' => false]); - // Template color if ($this->params->get('templateColor')) {