Back to UiTab class

Method startTabSet

public static string
startTabSet
(mixed $selector = 'myTab', mixed $params = array())
Creates a core UI tab pane
Parameters
  • string $selector The pane identifier.
  • array $params The parameters for the pane
Returns
  • string
Since
  • 4.0.0
Class: UiTab
Project: Joomla

Method startTabSet - Source code

/**
 * Creates a core UI tab pane
 *
 * @param   string  $selector  The pane identifier.
 * @param   array   $params    The parameters for the pane
 *
 * @return  string
 *
 * @since   4.0.0
 */
public static function startTabSet($selector = 'myTab', $params = array())
{
    $sig = md5(serialize(array($selector, $params)));
    if (!isset(static::$loaded[__METHOD__][$sig])) {
        // Include the custom element
        Factory::getDocument()->getWebAssetManager()->useStyle('webcomponent.joomla-tab')->useScript('webcomponent.joomla-tab');
        // Setup options object
        $opt['active'] = isset($params['active']) && $params['active'] ? (string) $params['active'] : '';
        // Set static array
        static::$loaded[__METHOD__][$sig] = true;
        static::$loaded[__METHOD__][$selector]['active'] = $opt['active'];
    }
    $orientation = isset($params['orientation']) ? $params['orientation'] : 'horizontal';
    $recall = isset($params['recall']) ? 'recall' : '';
    $breakpoint = isset($params['breakpoint']) ? 'breakpoint="' . $params['breakpoint'] . '"' : '';
    if (!isset($params['breakpoint']) && $breakpoint === '') {
        $breakpoint = 'breakpoint="768"';
    }
    return '<joomla-tab id="' . $selector . '" orientation="' . $orientation . '" ' . $recall . ' ' . $breakpoint . '>';
}