CoreFiles by mySites.guru
uitab.php99 lines, 2,499 bytes, from Joomla_4.0.0-alpha8-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha7
md5
4e6cdf76064ffacfa0ae6c9a52907137
sha1
33f42ae1813dfcc6d4d9e6b1aacb32d7c912cc0f
sha256
f1599e173d33892985ccb9ca5e962c38d714ca52142447ae9c89842928ea3cee
<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_PLATFORM') or die;

/**
 * Utility class for the Joomla core UI Tab element.
 *
 * @since  4.0.0
 */
abstract class JHtmlUiTab
{
	/**
	 * @var    array  Array containing information for loaded files
	 * @since  4.0.0
	 */
	protected static $loaded = array();

	/**
	 * 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
			JHtml::_('webcomponent', 'vendor/joomla-custom-elements/joomla-tab.min.js', ['version' => 'auto', 'relative' => true]);

			// 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'];
		}

		// @TODO echo the recall attribute correctly, now it's hardcoded!!!
		$recall = !isset($params['recall']) ? '' : 'recall';
		return '<joomla-tab id="' . $selector . '" recall>';
	}

	/**
	 * Close the current tab pane
	 *
	 * @return  string  HTML to close the pane
	 *
	 * @since   4.0.0
	 */
	public static function endTabSet()
	{
		return '</joomla-tab>';
	}

	/**
	 * Begins the display of a new tab content panel.
	 *
	 * @param   string  $selector  Identifier of the panel.
	 * @param   string  $id        The ID of the div element
	 * @param   string  $title     The title text for the new UL tab
	 *
	 * @return  string  HTML to start a new panel
	 *
	 * @since   4.0.0
	 */
	public static function addTab($selector, $id, $title)
	{
		$active = (static::$loaded['JHtmlUiTab::startTabSet'][$selector]['active'] == $id) ? ' active' : '';

		return '<section id="' . $id . '" class="' . $active . '" name="' . htmlspecialchars($title, ENT_COMPAT, 'UTF-8') . '">';

	}

	/**
	 * Close the current tab content panel
	 *
	 * @return  string  HTML to close the pane
	 *
	 * @since   4.0.0
	 */
	public static function endTab()
	{
		return '</section>';
	}
}

The same content is in 2 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha8. See them all, or every version of this file.