本文整理汇总了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">';
}