class JHtmlBootstrap

Utility class for Bootstrap elements.

Methods

static  void
affix( string $selector = 'affix', array $params = array())

Add javascript support for the Bootstrap affix plugin

static  void
alert( string $selector = 'alert')

Add javascript support for Bootstrap alerts

static  void
button( string $selector = 'button')

Add javascript support for Bootstrap buttons

static  void
carousel( string $selector = 'carousel', array $params = array())

Add javascript support for Bootstrap carousels

static  void
dropdown( string $selector = 'dropdown-toggle')

Add javascript support for Bootstrap dropdowns

static  void
framework( mixed $debug = null)

Method to load the Bootstrap JavaScript framework into the document head

static  void
modal( string $selector = 'modal', array $params = array())

Add javascript support for Bootstrap modals

static  string
renderModal( string $selector = 'modal', array $params = array(), string $body = '')

Method to render a Bootstrap modal

static  void
popover( string $selector = '.hasPopover', array $params = array())

Add javascript support for Bootstrap popovers

static  void
scrollspy( string $selector = 'navbar', array $params = array())

Add javascript support for Bootstrap ScrollSpy

static  void
tooltip( string $selector = '.hasTooltip', array $params = array())

Add javascript support for Bootstrap tooltips

static  void
tooltipExtended( boolean $extended = true)

Loads js and css files needed by Bootstrap Tooltip Extended plugin

static  void
typeahead( string $selector = '.typeahead', array $params = array())

Add javascript support for Bootstrap typeahead

static  string
startAccordion( string $selector = 'myAccordian', array $params = array())

Add javascript support for Bootstrap accordians and insert the accordian

static  string
endAccordion()

Close the current accordion

static  string
addSlide( string $selector, string $text, string $id, string $class = '')

Begins the display of a new accordion slide.

static  string
endSlide()

Close the current slide

static  string
startTabSet( string $selector = 'myTab', array $params = array())

Creates a tab pane

static  string
endTabSet()

Close the current tab pane

static  string
addTab( string $selector, string $id, string $title)

Begins the display of a new tab content panel.

static  string
endTab()

Close the current tab content panel

static  string
startPane( string $selector = 'myTab', array $params = array())

Creates a tab pane

static  string
endPane()

Close the current tab pane

static  string
addPanel( string $selector, string $id)

Begins the display of a new tab content panel.

static  string
endPanel()

Close the current tab content panel

static  void
loadCss( boolean $includeMainCss = true, string $direction = 'ltr', array $attribs = array())

Loads CSS files needed by Bootstrap

Details

static void affix( string $selector = 'affix', array $params = array())

Add javascript support for the Bootstrap affix plugin

Parameters

string $selector Unique selector for the element to be affixed.
array $params An array of options. Options for the affix plugin can be: - offset number|function|object Pixels to offset from screen when calculating position of scroll. If a single number is provided, the offset will be applied in both top and left directions. To listen for a single direction, or multiple unique offsets, just provide an object offset: { x: 10 }. Use a function when you need to dynamically provide an offset (useful for some responsive designs).

Return Value

void

static void alert( string $selector = 'alert')

Add javascript support for Bootstrap alerts

Parameters

string $selector Common class for the alerts

Return Value

void

static void button( string $selector = 'button')

Add javascript support for Bootstrap buttons

Parameters

string $selector Common class for the buttons

Return Value

void

Add javascript support for Bootstrap carousels

Parameters

string $selector Common class for the carousels.
array $params An array of options for the carousel. Options for the carousel can be: - interval number The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. - pause string Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.

Return Value

void

static void dropdown( string $selector = 'dropdown-toggle')

Add javascript support for Bootstrap dropdowns

Parameters

string $selector Common class for the dropdowns

Return Value

void

static void framework( mixed $debug = null)

Method to load the Bootstrap JavaScript framework into the document head

If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging.

Parameters

mixed $debug Is debugging mode on? [optional]

Return Value

void

static void modal( string $selector = 'modal', array $params = array())

Add javascript support for Bootstrap modals

Parameters

string $selector The ID selector for the modal.
array $params An array of options for the modal. Options for the modal can be: - backdrop boolean Includes a modal-backdrop element. - keyboard boolean Closes the modal when escape key is pressed. - show boolean Shows the modal when initialized. - remote string An optional remote URL to load

Return Value

void

static string renderModal( string $selector = 'modal', array $params = array(), string $body = '')

Method to render a Bootstrap modal

Parameters

string $selector The ID selector for the modal.
array $params An array of options for the modal. Options for the modal can be: - title string The modal title - backdrop mixed A boolean select if a modal-backdrop element should be included (default = true) The string 'static' includes a backdrop which doesn't close the modal on click. - keyboard boolean Closes the modal when escape key is pressed (default = true) - closeButton boolean Display modal close button (default = true) - animation boolean Fade in from the top of the page (default = true) - footer string Optional markup for the modal footer - url string URL of a resource to be inserted as an <iframe> inside the modal body - height string height of the <iframe> containing the remote resource - width string width of the <iframe> containing the remote resource
string $body Markup for the modal body. Appended after the <iframe> if the URL option is set

Return Value

string HTML markup for a modal

static void popover( string $selector = '.hasPopover', array $params = array())

Add javascript support for Bootstrap popovers

Use element's Title as popover content

Parameters

string $selector Selector for the popover
array $params An array of options for the popover. Options for the popover can be: animation boolean apply a css fade transition to the popover html boolean Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the dom. placement string|function how to position the popover - top | bottom | left | right selector string If a selector is provided, popover objects will be delegated to the specified targets. trigger string how popover is triggered - hover | focus | manual title string|function default title value if title tag isn't present content string|function default content value if data-content attribute isn't present delay number|object delay showing and hiding the popover (ms) - does not apply to manual trigger type If a number is supplied, delay is applied to both hide/show Object structure is: delay: { show: 500, hide: 100 } container string|boolean Appends the popover to a specific element: { container: 'body' }

Return Value

void

static void scrollspy( string $selector = 'navbar', array $params = array())

Add javascript support for Bootstrap ScrollSpy

Parameters

string $selector The ID selector for the ScrollSpy element.
array $params An array of options for the ScrollSpy. Options for the ScrollSpy can be: - offset number Pixels to offset from top when calculating position of scroll.

Return Value

void

static void tooltip( string $selector = '.hasTooltip', array $params = array())

Add javascript support for Bootstrap tooltips

Add a title attribute to any element in the form title="title::text"

Parameters

string $selector The ID selector for the tooltip.
array $params An array of options for the tooltip. Options for the tooltip can be: - animation boolean Apply a CSS fade transition to the tooltip - html boolean Insert HTML into the tooltip. If false, jQuery's text method will be used to insert content into the dom. - placement string|function How to position the tooltip - top | bottom | left | right - selector string If a selector is provided, tooltip objects will be delegated to the specified targets. - title string|function Default title value if title tag isn't present - trigger string How tooltip is triggered - hover | focus | manual - delay integer Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type If a number is supplied, delay is applied to both hide/show Object structure is: delay: { show: 500, hide: 100 } - container string|boolean Appends the popover to a specific element: { container: 'body' }

Return Value

void

static void tooltipExtended( boolean $extended = true)

Loads js and css files needed by Bootstrap Tooltip Extended plugin

Parameters

boolean $extended If true, bootstrap-tooltip-extended.js and .css files are loaded

Return Value

void

static void typeahead( string $selector = '.typeahead', array $params = array())

Add javascript support for Bootstrap typeahead

Parameters

string $selector The selector for the typeahead element.
array $params An array of options for the typeahead element. Options for the tooltip can be: - source array, function The data source to query against. May be an array of strings or a function. The function is passed two arguments, the query value in the input field and the process callback. The function may be used synchronously by returning the data source directly or asynchronously via the process callback's single argument. - items number The max number of items to display in the dropdown. - minLength number The minimum character length needed before triggering autocomplete suggestions - matcher function The method used to determine if a query matches an item. Accepts a single argument, the item against which to test the query. Access the current query with this.query. Return a boolean true if query is a match. - sorter function Method used to sort autocomplete results. Accepts a single argument items and has the scope of the typeahead instance. Reference the current query with this.query. - updater function The method used to return selected item. Accepts a single argument, the item and has the scope of the typeahead instance. - highlighter function Method used to highlight autocomplete results. Accepts a single argument item and has the scope of the typeahead instance. Should return html.

Return Value

void

static string startAccordion( string $selector = 'myAccordian', array $params = array())

Add javascript support for Bootstrap accordians and insert the accordian

Parameters

string $selector The ID selector for the tooltip.
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

                        - onShow    function  This event fires immediately when the show instance method is called.
                        - onShown   function  This event is fired when a collapse element has been made visible to the user
                                              (will wait for css transitions to complete).
                        - onHide    function  This event is fired immediately when the hide method has been called.
                        - onHidden  function  This event is fired when a collapse element has been hidden from the user
                                              (will wait for css transitions to complete).

Return Value

string HTML for the accordian

static string endAccordion()

Close the current accordion

Return Value

string HTML to close the accordian

static string addSlide( string $selector, string $text, string $id, string $class = '')

Begins the display of a new accordion slide.

Parameters

string $selector Identifier of the accordion group.
string $text Text to display.
string $id Identifier of the slide.
string $class Class of the accordion group.

Return Value

string HTML to add the slide

static string endSlide()

Close the current slide

Return Value

string HTML to close the slide

static string startTabSet( string $selector = 'myTab', array $params = array())

Creates a tab pane

Parameters

string $selector The pane identifier.
array $params The parameters for the pane

Return Value

string

static string endTabSet()

Close the current tab pane

Return Value

string HTML to close the pane

static string addTab( string $selector, string $id, string $title)

Begins the display of a new tab content panel.

Parameters

string $selector Identifier of the panel.
string $id The ID of the div element
string $title The title text for the new UL tab

Return Value

string HTML to start a new panel

static string endTab()

Close the current tab content panel

Return Value

string HTML to close the pane

static string startPane( string $selector = 'myTab', array $params = array())

Creates a tab pane

Parameters

string $selector The pane identifier.
array $params The parameters for the pane

Return Value

string

static string endPane()

Close the current tab pane

Return Value

string HTML to close the pane

static string addPanel( string $selector, string $id)

Begins the display of a new tab content panel.

Parameters

string $selector Identifier of the panel.
string $id The ID of the div element

Return Value

string HTML to start a new panel

static string endPanel()

Close the current tab content panel

Return Value

string HTML to close the pane

static void loadCss( boolean $includeMainCss = true, string $direction = 'ltr', array $attribs = array())

Loads CSS files needed by Bootstrap

Parameters

boolean $includeMainCss If true, main bootstrap.css files are loaded
string $direction rtl or ltr direction. If empty, ltr is assumed
array $attribs Optional array of attributes to be passed to JHtml::_('stylesheet')

Return Value

void