Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
$wa->useScript('form.validate')
->useScript('keepalive');

if ($this->fieldsets) {
HTMLHelper::_('bootstrap.framework');
}

$xml = $this->form->getXml();
?>

Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/plg_behaviour_compat6.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
29 changes: 0 additions & 29 deletions libraries/src/HTML/Helpers/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/HTML/Helpers/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function init()
}

// Depends on Bootstrap
HTMLHelper::_('bootstrap.framework');
HTMLHelper::_('bootstrap.dropdown');

Factory::getDocument()->addScriptDeclaration("
(function($){
Expand Down
13 changes: 12 additions & 1 deletion plugins/behaviour/compat6/compat6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="html_helpers"
type="radio"
label="PLG_COMPAT_FIELD_HTML_HELPERS_LABEL"
description="PLG_COMPAT_FIELD_HTML_HELPERS_DESCRIPTION"
layout="joomla.form.field.radio.switcher"
default="1"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="legacy_classes"
type="radio"
Expand All @@ -46,7 +58,6 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

</fieldset>
</fields>
</config>
Expand Down
23 changes: 23 additions & 0 deletions plugins/behaviour/compat6/src/Extension/Compat6.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,6 +44,7 @@ public static function getSubscribedEvents(): array
*/
return [
'onAfterInitialiseDocument' => ['onAfterInitialiseDocument', Priority::HIGH],
'onAfterInitialise' => ['onAfterInitialise', Priority::HIGH],
];
}

Expand Down Expand Up @@ -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);
}
}
}
39 changes: 39 additions & 0 deletions plugins/behaviour/compat6/src/HTMLHelper/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
* @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']
);
}
}
Loading