本文整理匯總了PHP中JHtmlBootstrap::getJSObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP JHtmlBootstrap::getJSObject方法的具體用法?PHP JHtmlBootstrap::getJSObject怎麽用?PHP JHtmlBootstrap::getJSObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JHtmlBootstrap
的用法示例。
在下文中一共展示了JHtmlBootstrap::getJSObject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: startAccordion
/**
* Add javascript support for Bootstrap accordians and insert the accordian
*
* @param string $selector The ID selector for the tooltip.
* @param array $params An array of options for the tooltip.
* Options for the tooltip can be:
* - parent selector If selector then all collapsible elements under the specified parent will be closed when this
* collapsible item is shown. (similar to traditional accordion behavior)
* - toggle boolean Toggles the collapsible element on invocation
* - active string Sets the active slide during load
*
* @return string HTML for the accordian
*
* @since 3.0
*/
public static function startAccordion($selector = 'myAccordian', $params = array())
{
$sig = md5(serialize(array($selector, $params)));
if (!isset(static::$loaded[__METHOD__][$sig])) {
// Include Bootstrap framework
static::framework();
// Setup options object
$opt['parent'] = isset($params['parent']) ? (bool) $params['parent'] : false;
$opt['toggle'] = isset($params['toggle']) ? (bool) $params['toggle'] : true;
$opt['active'] = isset($params['active']) ? (string) $params['active'] : '';
$options = JHtmlBootstrap::getJSObject($opt);
// Attach accordion to document
JFactory::getDocument()->addScriptDeclaration("(function(\$){\n \$('#{$selector}').collapse({$options});\n })(jQuery);");
// Set static array
static::$loaded[__METHOD__][$sig] = true;
static::$loaded[__METHOD__]['active'] = $opt['active'];
}
return '<div id="' . $selector . '" class="accordion">';
}