JHtmlBootstrap

Utility class for Bootstrap elements.

abstract
since

3.0

package

Joomla.Libraries

Methods

addPanel

Begins the display of a new tab content panel.

addPanel(string $selector, string $id) : string
static deprecated
since

3.0

deprecated

4.0 Use JHtml::_('bootstrap.addTab') instead.

Arguments

$selector

stringIdentifier of the panel.

$id

stringThe ID of the div element

Response

stringHTML to start a new panel

addSlide

Begins the display of a new accordion slide.

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

3.0

Arguments

$selector

stringIdentifier of the accordion group.

$text

stringText to display.

$id

stringIdentifier of the slide.

$class

stringClass of the accordion group.

Response

stringHTML to add the slide

addTab

Begins the display of a new tab content panel.

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

3.1

Arguments

$selector

stringIdentifier of the panel.

$id

stringThe ID of the div element

$title

stringThe title text for the new UL tab

Response

stringHTML to start a new panel

affix

Add javascript support for the Bootstrap affix plugin

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

3.1

deprecated

4.0 Bootstrap 4.0 dropped this so will Joomla.

Arguments

$selector

stringUnique selector for the element to be affixed.

$params

arrayAn 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).

alert

Add javascript support for Bootstrap alerts

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

3.0

Arguments

$selector

stringCommon class for the alerts

button

Add javascript support for Bootstrap buttons

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

3.1

Arguments

$selector

stringCommon class for the buttons

dropdown

Add javascript support for Bootstrap dropdowns

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

3.0

Arguments

$selector

stringCommon class for the dropdowns

endAccordion

Close the current accordion

endAccordion() : string
static
since

3.0

Response

stringHTML to close the accordian

endPane

Close the current tab pane

endPane() : string
static deprecated
since

3.0

deprecated

4.0 Use JHtml::_('bootstrap.endTabSet') instead.

Response

stringHTML to close the pane

endPanel

Close the current tab content panel

endPanel() : string
static deprecated
since

3.0

deprecated

4.0 Use JHtml::_('bootstrap.endTab') instead.

Response

stringHTML to close the pane

endSlide

Close the current slide

endSlide() : string
static
since

3.0

Response

stringHTML to close the slide

endTab

Close the current tab content panel

endTab() : string
static
since

3.1

Response

stringHTML to close the pane

endTabSet

Close the current tab pane

endTabSet() : string
static
since

3.1

Response

stringHTML to close the pane

framework

Method to load the Bootstrap JavaScript framework into the document head

framework(mixed $debug = null) : void
static

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

since

3.0

Arguments

$debug

mixedIs debugging mode on? [optional]

loadCss

Loads CSS files needed by Bootstrap

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

3.0

Arguments

$includeMainCss

booleanIf true, main bootstrap.css files are loaded

$direction

stringrtl or ltr direction. If empty, ltr is assumed

$attribs

arrayOptional array of attributes to be passed to JHtml::_('stylesheet')

modal

Add javascript support for Bootstrap modals

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

3.0

deprecated

4.0 This method was used by the old renderModal() implementation. Since the new implementation it is unneeded and the broken JS it was injecting could create issues As a case, please see: https://github.com/joomla/joomla-cms/pull/6918

Arguments

$selector

stringThe ID selector for the modal.

$params

arrayAn 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

popover

Add javascript support for Bootstrap popovers

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

Use element's Title as popover content

since

3.0

Arguments

$selector

stringSelector for the popover

$params

arrayAn 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' }

renderModal

Method to render a Bootstrap modal

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

3.0

Arguments

$selector

stringThe ID selector for the modal.

$params

arrayAn 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
$body

stringMarkup for the modal body. Appended after the <iframe> if the URL option is set

Response

stringHTML markup for a modal

scrollspy

Add javascript support for Bootstrap ScrollSpy

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

3.0

Arguments

$selector

stringThe ID selector for the ScrollSpy element.

$params

arrayAn array of options for the ScrollSpy. Options for the ScrollSpy can be:

  • offset number Pixels to offset from top when calculating position of scroll.

startAccordion

Add javascript support for Bootstrap accordians and insert the accordian

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

3.0

Arguments

$selector

stringThe ID selector for the tooltip.

$params

arrayAn 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).

Response

stringHTML for the accordian

startPane

Creates a tab pane

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

3.0

deprecated

4.0 Use JHtml::_('bootstrap.startTabSet') instead.

Arguments

$selector

stringThe pane identifier.

$params

arrayThe parameters for the pane

Response

string

startTabSet

Creates a tab pane

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

3.1

Arguments

$selector

stringThe pane identifier.

$params

arrayThe parameters for the pane

Response

string

tooltip

Add javascript support for Bootstrap tooltips

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

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

since

3.0

Arguments

$selector

stringThe ID selector for the tooltip.

$params

arrayAn 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' }

tooltipExtended

Loads js and css files needed by Bootstrap Tooltip Extended plugin

tooltipExtended(boolean $extended = true) : void
static deprecated
since

3.6

deprecated

4.0 No replacement, use Bootstrap tooltips.

Arguments

$extended

booleanIf true, bootstrap-tooltip-extended.js and .css files are loaded

typeahead

Add javascript support for Bootstrap typeahead

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

3.0

deprecated

4.0 Bootstrap 4.0 dropped this so will Joomla.

Arguments

$selector

stringThe selector for the typeahead element.

$params

arrayAn 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.

Properties

loaded

Array containing information for loaded files

static
since

3.0

Type(s)

array