diff --git a/administrator/components/com_config/tmpl/component/default.php b/administrator/components/com_config/tmpl/component/default.php index fb439f77db7ab..e63a0aea620d5 100644 --- a/administrator/components/com_config/tmpl/component/default.php +++ b/administrator/components/com_config/tmpl/component/default.php @@ -31,10 +31,6 @@ $wa->useScript('form.validate') ->useScript('keepalive'); -if ($this->fieldsets) { - HTMLHelper::_('bootstrap.framework'); -} - $xml = $this->form->getXml(); ?> diff --git a/administrator/language/en-GB/plg_behaviour_compat6.ini b/administrator/language/en-GB/plg_behaviour_compat6.ini index 421c8d8d8890a..8fa307dd557b6 100644 --- a/administrator/language/en-GB/plg_behaviour_compat6.ini +++ b/administrator/language/en-GB/plg_behaviour_compat6.ini @@ -6,6 +6,7 @@ PLG_BEHAVIOUR_COMPAT6="Behaviour - Backward Compatibility 6" PLG_COMPAT6_FIELD_CLASSES_ALIASES_DESCRIPTION="Add class aliases for classes which have been renamed or moved to a namespace." PLG_COMPAT6_FIELD_CLASSES_ALIASES_LABEL="Classes Aliases" +PLG_COMPAT6_FIELD_HTML_HELPERS_DESCRIPTION="Activate this option if your extension requires deprecated HTMLHelper classes or functions. When enabled, will provide backward compatibility to the prior major version." PLG_COMPAT6_FIELD_LEGACY_CLASSES_DESCRIPTION="Activate this option if your extension requires previously deprecated classes removed from the current version of Joomla. These removed classes can be found in the folder /plugins/behavior/compat6/classes/." PLG_COMPAT6_FIELD_LEGACY_CLASSES_LABEL="Include Deprecated Classes" PLG_COMPAT6_FIELD_REMOVED_ASSETS_DESCRIPTION="Activate this option if your extension requires removed assets which has resulted in an exception. The assets provided are empty but prevent the exception." diff --git a/libraries/src/HTML/Helpers/Bootstrap.php b/libraries/src/HTML/Helpers/Bootstrap.php index 436ce382ae103..ff28b98155297 100644 --- a/libraries/src/HTML/Helpers/Bootstrap.php +++ b/libraries/src/HTML/Helpers/Bootstrap.php @@ -616,35 +616,6 @@ public static function toast($selector = '', $options = []): void static::$loaded[__METHOD__][$selector] = true; } - /** - * Method to load the ALL the Bootstrap Components - * - * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging. - * - * @param mixed $debug Is debugging mode on? [optional] - * - * @return void - * - * @since 3.0 - * - * @deprecated 4.0 will be removed in 6.0 - * Will be removed without replacement - * Load the different scripts with their individual method calls - */ - public static function framework($debug = null): void - { - $wa = Factory::getApplication() - ->getDocument() - ->getWebAssetManager(); - - array_map( - function ($script) use ($wa) { - $wa->useScript('bootstrap.' . $script); - }, - ['alert', 'button', 'carousel', 'collapse', 'dropdown', 'modal', 'offcanvas', 'popover', 'scrollspy', 'tab', 'toast'] - ); - } - /** * Loads CSS files needed by Bootstrap * diff --git a/libraries/src/HTML/Helpers/Dropdown.php b/libraries/src/HTML/Helpers/Dropdown.php index 4938cf005d64f..2a43df6e34fb5 100644 --- a/libraries/src/HTML/Helpers/Dropdown.php +++ b/libraries/src/HTML/Helpers/Dropdown.php @@ -52,7 +52,7 @@ public static function init() } // Depends on Bootstrap - HTMLHelper::_('bootstrap.framework'); + HTMLHelper::_('bootstrap.dropdown'); Factory::getDocument()->addScriptDeclaration(" (function($){ diff --git a/plugins/behaviour/compat6/compat6.xml b/plugins/behaviour/compat6/compat6.xml index 0ab8cadab9620..4909c1028d5cc 100644 --- a/plugins/behaviour/compat6/compat6.xml +++ b/plugins/behaviour/compat6/compat6.xml @@ -34,6 +34,18 @@ + + + + JNO - diff --git a/plugins/behaviour/compat6/src/Extension/Compat6.php b/plugins/behaviour/compat6/src/Extension/Compat6.php index a7900a597bb37..57136bb598180 100644 --- a/plugins/behaviour/compat6/src/Extension/Compat6.php +++ b/plugins/behaviour/compat6/src/Extension/Compat6.php @@ -11,6 +11,7 @@ namespace Joomla\Plugin\Behaviour\Compat6\Extension; use Joomla\CMS\Event\Application\AfterInitialiseDocumentEvent; +use Joomla\CMS\Factory; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Event\DispatcherInterface; use Joomla\Event\Priority; @@ -43,6 +44,7 @@ public static function getSubscribedEvents(): array */ return [ 'onAfterInitialiseDocument' => ['onAfterInitialiseDocument', Priority::HIGH], + 'onAfterInitialise' => ['onAfterInitialise', Priority::HIGH], ]; } @@ -111,4 +113,25 @@ public function onAfterInitialiseDocument(AfterInitialiseDocumentEvent $event) ->addRegistryFile('media/plg_behaviour_compat6/removed.asset.json'); } } + + /** + * The after Initialise logic + * + * @param After Initialise $event + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function onAfterInitialise($event) + { + /** + * Load the deprecated HTMLHelper classes/functions + * likely be removed in Joomla 7.0 + */ + if ($this->params->get('html_helpers', '1')) { + // Restore HTMLHelper::Bootstrap('framework') + Factory::getContainer()->get(\Joomla\CMS\HTML\Registry::class) + ->register('bootstrap', \Joomla\Plugin\Behaviour\Compat\HTMLHelper\Bootstrap::class, true); + } + } } diff --git a/plugins/behaviour/compat6/src/HTMLHelper/Bootstrap.php b/plugins/behaviour/compat6/src/HTMLHelper/Bootstrap.php new file mode 100644 index 0000000000000..6f44d382f3509 --- /dev/null +++ b/plugins/behaviour/compat6/src/HTMLHelper/Bootstrap.php @@ -0,0 +1,39 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace Joomla\Plugin\Behaviour\Compat\HTMLHelper; + +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\Helpers\Bootstrap as OriginalBootstrap; + +class Bootstrap extends OriginalBootstrap +{ + /** + * Method to load the ALL the Bootstrap Components + * + * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging. + * + * @param mixed $debug Is debugging mode on? [optional] + * + * @return void + * + * @deprecated 4.0 will be removed in 7.0 + * Will be removed without replacement + * Load the different scripts with their individual method calls + */ + public static function framework($debug = null): void + { + $wa = Factory::getApplication()->getDocument()->getWebAssetManager(); + + array_map( + function ($script) use ($wa) { + $wa->useScript('bootstrap.' . $script); + }, + ['alert', 'button', 'carousel', 'collapse', 'dropdown', 'modal', 'offcanvas', 'popover', 'scrollspy', 'tab', 'toast'] + ); + } +}