1111namespace Joomla \Plugin \Behaviour \Compat6 \Extension ;
1212
1313use Joomla \CMS \Event \Application \AfterInitialiseDocumentEvent ;
14- use Joomla \CMS \Factory ;
15- use Joomla \CMS \HTML \HTMLHelper ;
1614use Joomla \CMS \Plugin \CMSPlugin ;
1715use Joomla \Event \DispatcherInterface ;
1816use Joomla \Event \Priority ;
1917use Joomla \Event \SubscriberInterface ;
18+ use Joomla \Plugin \Behaviour \Compat \HTMLHelper \Bootstrap ;
2019
2120// phpcs:disable PSR1.Files.SideEffects
2221\defined ('_JEXEC ' ) or die;
@@ -101,8 +100,13 @@ public function __construct(DispatcherInterface $dispatcher, array $config = [])
101100 */
102101 public function onAfterInitialiseDocument (AfterInitialiseDocumentEvent $ event )
103102 {
104- if (!HTMLHelper::isRegistered ('bootstrap.framework ' )) {
105- HTMLHelper::register ('bootstrap.framework ' , 'Joomla\Plugin\Behaviour\Compat\Extension\Compat::framework ' );
103+ /**
104+ * Load the deprecated HTMLHelper classes/functions
105+ * likely be removed in Joomla 7.0
106+ */
107+ if ($ this ->params ->get ('html_helpers ' , '1 ' )) {
108+ // Restore HTMLHelper::Bootstrap('framework')
109+ new Bootstrap ();
106110 }
107111
108112 /**
@@ -117,29 +121,4 @@ public function onAfterInitialiseDocument(AfterInitialiseDocumentEvent $event)
117121 ->addRegistryFile ('media/plg_behaviour_compat6/removed.asset.json ' );
118122 }
119123 }
120-
121- /**
122- * Method to load the ALL the Bootstrap Components
123- *
124- * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging.
125- *
126- * @param mixed $debug Is debugging mode on? [optional]
127- *
128- * @return void
129- *
130- * @deprecated 4.0 will be removed in 6.0
131- * Will be removed without replacement
132- * Load the different scripts with their individual method calls
133- */
134- public static function framework ($ debug = null ): void
135- {
136- $ wa = Factory::getApplication ()->getDocument ()->getWebAssetManager ();
137-
138- array_map (
139- function ($ script ) use ($ wa ) {
140- $ wa ->useScript ('bootstrap. ' . $ script );
141- },
142- ['alert ' , 'button ' , 'carousel ' , 'collapse ' , 'dropdown ' , 'modal ' , 'offcanvas ' , 'popover ' , 'scrollspy ' , 'tab ' , 'toast ' ]
143- );
144- }
145124}
0 commit comments