/**
* Add javascript support for Bootstrap tab
*
* @param string $selector Common class for the tabs
* @param array $options Options for the tabs
*
* @return void
*
* @throws \Exception
*
* @since 4.0.0
*/
public static function tab($selector = '', $options = []) : void
{
// Only load once
if (!empty(static::$loaded[__METHOD__][$selector])) {
return;
}
if ($selector !== '') {
Factory::getDocument()->addScriptOptions('bootstrap.tabs', [$selector => (object) $options]);
}
// Include the Bootstrap component
Factory::getApplication()->getDocument()->getWebAssetManager()->useScript('bootstrap.tab');
static::$loaded[__METHOD__][$selector] = true;
}