Back to Bootstrap class

Method tab

public static void
tab
(mixed $selector = '', mixed $options = [])
Add javascript support for Bootstrap tab
Parameters
  • string $selector Common class for the tabs
  • array $options Options for the tabs
Returns
  • void
Since
  • 4.0.0
-
  • \Exception
Class: Bootstrap
Project: Joomla

Method tab - Source code

/**
 * 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;
}