Method | Description | |
---|---|---|
abbr ( string $content, string $title, boolean $initialism = false, array $options = [] ) : string | Generates a bootstrap abbreviation. | |
activeCheckboxButtonGroup ( |
Generates an active bootstrap checkbox button group. A checkbox button group allows multiple selection, like [[listBox()]]. As a result, the corresponding submitted value is an array. The selection of the checkbox button group is taken from the value of the model attribute. | |
activeRadioButtonGroup ( |
Generates an active bootstrap radio button group. A radio button group is like a checkbox button group, except that it only allows single selection. The selection of the radio buttons is taken from the value of the model attribute. | |
address ( string $name, array $lines = [], array $phone = [], array $email = [], array $options = [], string $phoneLabel = '(P)', string $emailLabel = '(E)' ) : string | Generates a bootstrap address block. | |
badge ( string $content, array $options = [], string $tag = 'span' ) : string | Generates a badge. | |
blockquote ( string $content, string $citeContent = '', string $citeTitle = '', string $citeSource = '', array $options = [] ) : string | Generates a bootstrap blockquote. | |
bsLabel ( string $content, string $type = 'default', array $options = [], string $prefix = 'label label-', string $tag = 'span' ) : string | Generates a bootstrap label markup. | |
caret ( string $direction = 'down', boolean $disabled = false, array $options = [], string $tag = 'span' ) : string | Generates a bootstrap caret. | |
checkboxButtonGroup ( string $name, string | array $selection = null, array $items = [], array $options = [] ) : string | Generates a bootstrap checkbox button group. A checkbox button group allows multiple selection, like [[listBox()]]. As a result, the corresponding submitted value is an array. | |
closeButton ( string $label = '×', array $options = [], string $tag = 'button' ) : string | Generates a generic bootstrap close icon button for dismissing content like modals and alerts. | |
getButtonGroup ( string $type, string $name, string | array $selection = null, array $items = [], array $options = [] ) : string | Generates a bootstrap toggle button group (checkbox or radio type) | |
icon ( string $icon, array $options = [], string $prefix = 'glyphicon glyphicon-', string $tag = 'span' ) : string | Generates a bootstrap icon markup. | |
jumbotron ( string | array $content = [], boolean $fullWidth = false, array $options = [] ) : string | Generates a jumbotron - a lightweight, flexible component that can optionally extend the entire viewport to showcase key content on your site. | |
listGroup ( array $items = [], array $options = [], string $tag = 'div', string $itemTag = 'div' ) : string | Generates a list group. Flexible and powerful component for displaying not only simple lists of elements, but complex ones with custom content. | |
media ( string $heading = '', string $body = '', string | array $src = '', string | array $img = '', array $srcOptions = [], array $imgOptions = [], array $headingOptions = [], array $bodyOptions = [], array $options = [], string $tag = 'div' ) : string | Generates a bootstrap media object. Abstract object styles for building various types of components (like blog comments, Tweets, etc) that feature a left-aligned or right-aligned image alongside textual content. | |
mediaList ( array $items = [], array $options = [] ) : string | Generates bootstrap list of media (useful for comment threads or articles lists). | |
pageHeader ( string $title, string $subTitle = '', array $options = [] ) : string | Generates a page header. | |
panel ( array $content = [], string $type = 'default', array $options = [], string $prefix = 'panel panel-' ) : string | Generates a panel for boxing content. | |
radioButtonGroup ( string $name, string | array $selection = null, array $items = [], array $options = [] ) : string | Generates a bootstrap radio button group. A radio button group is like a checkbox button group, except that it only allows single selection. | |
well ( string $content, string $size = '', array $options = [] ) : string | Generates a well container. |
Method | Description | |
---|---|---|
getListGroupItem ( array $item, string $tag ) : string | Processes and generates each list group item | |
getMediaItem ( array $item = [], string $tag = 'div' ) : string | Processes and generates each media item | |
getMediaList ( array $items, boolean $top = true ) : string | Processes media items array to generate a recursive list. | |
getPanelContent ( array $content, string $type ) : string | Generates panel content | |
getPanelTitle ( array $content, string $type ) : string | Generates panel title for heading and footer. |
public static abbr ( string $content, string $title, boolean $initialism = false, array $options = [] ) : string | ||
$content | string | the abbreviation content |
$title | string | the abbreviation title |
$initialism | boolean | if set to true, will display a slightly smaller font-size. |
$options | array | html options for the abbreviation |
return | string |
public static activeCheckboxButtonGroup ( |
||
$model | the model object | |
$attribute | string | the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression. |
$items | array | the data item used to generate the checkboxes. The array keys are the checkbox values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will. |
$options | array | options (name => config) for the checkbox list container tag. The following options are specially handled: - `tag`: _string_, the tag name of the container element. - `unselect`: _string_, the value that should be submitted when none of the checkboxes is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. - `encode`: _boolean_, whether to HTML-encode the checkbox labels. Defaults to `true`. This option is ignored if `item` option is set. - `separator`: _string_, the HTML code that separates items. - `itemOptions`: _array_, the options for generating the checkbox tag using [[checkbox()]]. - `item`: _Closure_, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ~~~ function ($index, $label, $name, $checked, $value) ~~~ where `$index` is the zero-based index of the checkbox in the whole list; `$label` is the label for the checkbox; and `$name`, `$value` and `$checked` represent the name, value and the checked status of the checkbox input. See [[renderTagAttributes()]] for details on how attributes are being rendered. |
return | string | the generated bootstrap checkbox button group |
public static activeRadioButtonGroup ( |
||
$model | the model object | |
$attribute | string | the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression. |
$items | array | the data item used to generate the radio buttons. The array keys are the radio values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will. |
$options | array | options (name => config) for the radio button list container tag. The following options are specially handled: - `tag`: _string_, the tag name of the container element. - `unselect`: _string_, the value that should be submitted when none of the radio buttons is selected. By setting this option, a hidden input will be generated. - `encode`: boolean, whether to HTML-encode the radio button labels. Defaults to `true`. This option is ignored if `item` option is set. - `separator`: _string_, the HTML code that separates items. - `itemOptions`: _array_, the options for generating the radio button tag using [[radio()]]. - `item`: _Closure_, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ~~~ function ($index, $label, $name, $checked, $value) ~~~ where `$index` is the zero-based index of the radio button in the whole list; `$label` is the label for the radio button; and `$name`, `$value` and `$checked` represent the name, value and the checked status of the radio button input. See [[renderTagAttributes()]] for details on how attributes are being rendered. |
return | string | the generated bootstrap radio button group |
public static address ( string $name, array $lines = [], array $phone = [], array $email = [], array $options = [], string $phoneLabel = '(P)', string $emailLabel = '(E)' ) : string | ||
$name | string | the addressee name. |
$lines | array | the lines of address information. |
$phone | array | the list of phone numbers - passed as $key => $value, where: - `$key`: _string_, is the phone type could be 'Res', 'Off', 'Cell', 'Fax'. - `$value`: _string_, is the phone number. |
array | the list of email addresses - passed as $key => $value, where: - `$key`: _string_, is the email type could be 'Res', 'Off'. - `$value`: _string_, is the email address. | |
$options | array | html options for the address. |
$phoneLabel | string | the prefix label for each phone - defaults to '(P)'. |
$emailLabel | string | the prefix label for each email - defaults to '(E)'. |
return | string |
public static blockquote ( string $content, string $citeContent = '', string $citeTitle = '', string $citeSource = '', array $options = [] ) : string | ||
$content | string | the blockquote content |
$citeContent | string | the content of the citation (optional) - this should typically include the tag '{source}' to embed the cite source |
$citeTitle | string | the cite source title (optional) |
$citeSource | string | the cite source (optional) |
$options | array | html options for the blockquote |
return | string |
public static bsLabel ( string $content, string $type = 'default', array $options = [], string $prefix = 'label label-', string $tag = 'span' ) : string | ||
$content | string | the label content |
$type | string | the bootstrap label type. Defaults to 'default'. Should be one of the bootstrap contextual colors: 'default, 'primary', 'success', 'info', 'danger', 'warning'. |
$options | array | HTML attributes / options for the label container |
$prefix | string | the CSS class prefix. Defaults to 'label label-'. |
$tag | string | the label container tag. Defaults to 'span'. |
return | string |
public static caret ( string $direction = 'down', boolean $disabled = false, array $options = [], string $tag = 'span' ) : string | ||
$direction | string | whether to display as 'up' or 'down' direction. Defaults to `down`. |
$disabled | boolean | if the caret is to be displayed as disabled. Defaults to `false`. |
$options | array | html options for the caret container. |
$tag | string | the html tag for rendering the caret. Defaults to `span`. |
return | string |
public static checkboxButtonGroup ( string $name, string | array $selection = null, array $items = [], array $options = [] ) : string | ||
$name | string | the name attribute of each checkbox. |
$selection | string | array | the selected value(s). |
$items | array | the data item used to generate the checkboxes. The array keys are the checkbox values, while the array values are the corresponding labels. |
$options | array | options (name => config) for the checkbox list container tag. The following options are specially handled: - `tag`: _string_, the tag name of the container element. - `unselect`: _string_, the value that should be submitted when none of the checkboxes is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. - `encode`: _boolean_, whether to HTML-encode the checkbox labels. Defaults to `true`. This option is ignored if `item` option is set. - `separator`: _string_, the HTML code that separates items. - `itemOptions`: _array_, the options for generating the checkbox tag using [[checkbox()]]. - `item`: _Closure_, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ~~~ function ($index, $label, $name, $checked, $value) ~~~ where `$index` is the zero-based index of the checkbox in the whole list; `$label` is the label for the checkbox; and `$name`, `$value` and `$checked` represent the name, value and the checked status of the checkbox input. See [[renderTagAttributes()]] for details on how attributes are being rendered. |
return | string | the generated checkbox button group |
public static closeButton ( string $label = '×', array $options = [], string $tag = 'button' ) : string | ||
$label | string | the close icon label. Defaults to `×`. |
$options | array | HTML attributes / options for the close icon button. |
$tag | string | the HTML tag for rendering the close icon. Defaults to `button`. |
return | string |
public static getButtonGroup ( string $type, string $name, string | array $selection = null, array $items = [], array $options = [] ) : string | ||
$type | string | whether checkbox or radio. |
$name | string | the name attribute of each checkbox. |
$selection | string | array | the selected value(s). |
$items | array | the data item used to generate the checkboxes/radios. The array keys are the checkbox/radio values, while the array values are the corresponding labels. |
$options | array | options (name => config) for the checkbox/radio list container tag. The following options are specially handled: - `tag`: _string_, the tag name of the container element. - `unselect`: _string_, the value that should be submitted when none of the checkboxes/radios is selected. By setting this option, a hidden input will be generated. - `encode`: boolean, whether to HTML-encode the checkbox/radio labels. Defaults to `true`. This option is ignored if `item` option is set. - `separator`: _string_, the HTML code that separates items. - `itemOptions`: _array_, the options for generating the checkbox/radio tag using [[checkbox()]]/[[radio()]]. - `item`: _Closure_, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ~~~ function ($index, $label, $name, $checked, $value) ~~~ where `$index` is the zero-based index of the checkbox/radio in the whole list; `$label` is the label for the checkbox/radio; and `$name`, `$value` and `$checked` represent the name, value and the checked status of the checkbox/radio input, respectively. See [[renderTagAttributes()]] for details on how attributes are being rendered. |
return | string | the generated toggle button group |
protected static getListGroupItem ( array $item, string $tag ) : string | ||
$item | array | the list item configuration. The following array key properties can be setup: - `content`: _string_|_array_, the list item content. When passed as a string, it will display this directly as a raw content. When passed as an array, it requires these keys: - `heading`: _string_, the content heading (optional). - `body`: _string_, the content body (optional). - `headingOptions`: _array_, the HTML attributes / options for heading container (optional). - `bodyOptions`: _array_, the HTML attributes / options for body container (optional). - `url`: string|array, the url for linking the list item content (optional). - `badge`: _string_, any badge content to be displayed for this list item (optional) - `badgeOptions`: _array_, the HTML attributes / options for badge container (optional). - `active`: _boolean_, to highlight the item as active (applicable only if $url is passed). Defaults to `false`. - `options`: _array_, HTML attributes / options for the list group item container (optional). |
$tag | string | the list item container tag (applied if it is not a link) |
return | string |
public static icon ( string $icon, array $options = [], string $prefix = 'glyphicon glyphicon-', string $tag = 'span' ) : string | ||
$icon | string | the bootstrap icon name without prefix (e.g. 'plus', 'pencil', 'trash') |
$options | array | HTML attributes / options for the icon container |
$prefix | string | the css class prefix - defaults to 'glyphicon glyphicon-' |
$tag | string | the icon container tag (usually 'span' or 'i') - defaults to 'span' |
return | string |
This is a simple jumbotron-style component for calling extra attention to featured content or information.
' ); echo Html::jumbotron([ 'heading' => 'Hello, world!', 'body' => 'This is a simple jumbotron-style component for calling extra attention to featured content or information.' ]); echo Html::jumbotron([ 'heading' => 'Hello, world!', 'body' => 'This is a simple jumbotron-style component for calling extra attention to featured content or information.' 'buttons' => [ [ 'label' => 'Learn More', 'icon' => 'book', 'url' => '#', 'type' => Html::TYPE_PRIMARY, 'size' => Html::LARGE ], [ 'label' => 'Contact Us', 'icon' => 'phone', 'url' => '#', 'type' => Html::TYPE_DANGER, 'size' => Html::LARGE ] ] ]); ~~~public static jumbotron ( string | array $content = [], boolean $fullWidth = false, array $options = [] ) : string | ||
$content | string | array | the list item content. When passed as a string, it will display this directly as a raw content. When passed as an array, it requires these keys: - `heading`: _string_, the jumbotron heading title - `body`: _string_, the jumbotron content body - `buttons`: _array_, the configuration for jumbotron buttons. The following properties can be set: - `label`: _string_, the button label - `icon`: _string_, the icon to place before the label - `url`: mixed, the button url - `type`: _string_, one of the bootstrap color modifier constants. Defaults to [[TYPE_DEFAULT]]. - `size`: _string_, one of the size modifier constants - `options`: _array_, the HTML attributes / options for the button. |
$fullWidth | boolean | whether this is a full width jumbotron without any corners. Defaults to `false`. |
$options | array | HTML attributes / options for the jumbotron container. |
return | string |
public static listGroup ( array $items = [], array $options = [], string $tag = 'div', string $itemTag = 'div' ) : string | ||
$items | array | the list group items. The following array key properties can be setup: - `content`: mixed, the list item content. When passed as a string, it will display this directly as a raw content. When passed as an array, it requires these keys - `heading`: _string_, the content heading (optional). - `headingOptions`: _array_, the HTML attributes / options for heading container (optional). - `body`: _string_, the content body (optional). - `bodyOptions`: _array_, the HTML attributes / options for body container (optional). - `url`: _string_|_array_, the url for linking the list item content (optional). - `badge`: _string_, any badge content to be displayed for this list item (optional) - `badgeOptions`: _array_, the HTML attributes / options for badge container (optional). - `active`: _boolean_, to highlight the item as active (applicable only if $url is passed). Defaults to `false`. - `options`: _array_, HTML attributes / options for the list group item container (optional). |
$options | array | HTML attributes / options for the list group container |
$tag | string | the list group container tag. Defaults to 'div'. |
$itemTag | string | the list item container tag. Defaults to 'div'. |
return | string |
public static media ( string $heading = '', string $body = '', string | array $src = '', string | array $img = '', array $srcOptions = [], array $imgOptions = [], array $headingOptions = [], array $bodyOptions = [], array $options = [], string $tag = 'div' ) : string | ||
$heading | string | the media heading. |
$body | string | the media content. |
$src | string | array | URL for the media article source. |
$img | string | array | URL for the media image source. |
$srcOptions | array | html options for the media article link. |
$imgOptions | array | html options for the media image. |
$headingOptions | array | HTML attributes / options for the media object heading container. |
$bodyOptions | array | HTML attributes / options for the media object body container. |
$options | array | HTML attributes / options for the media object container. |
$tag | string | the media container tag. Defaults to 'div'. |
return | string |
public static mediaList ( array $items = [], array $options = [] ) : string | ||
$items | array | the configuration of media items. The following properties can be set as array keys: - `items`: _array_, the sub media items (similar in configuration to items) (optional) - `heading`: _string_, the media heading - `body`: _string_, the media content - `src`: mixed, URL for the media article source - `img`: mixed, URL for the media image source - `srcOptions`: _array_, HTML attributes / options for the media article link (optional) - `imgOptions`: _array_, HTML attributes / options for the media image (optional) - `headingOptions`: _array_, HTML attributes / options for the media heading (optional) - `bodyOptions`: _array_, HTML attributes / options for the media body (optional) - `options`: _array_, HTML attributes / options for each media item (optional) |
$options | array | HTML attributes / options for the media list container |
return | string |
public static panel ( array $content = [], string $type = 'default', array $options = [], string $prefix = 'panel panel-' ) : string | ||
$content | array | the panel content configuration. The following properties can be setup: - `preHeading`: _string_, raw content that will be placed before `heading` (optional). - `heading`: _string_, the panel box heading (optional). - `preBody`: _string_, raw content that will be placed before $body (optional). - `body`: _string_, the panel body content - this will be wrapped in a "panel-body" container (optional). - `postBody`: _string_, raw content that will be placed after $body (optional). - `footer`: _string_, the panel box footer (optional). - `postFooter`: _string_, raw content that will be placed after $footer (optional). - `headingTitle`: _boolean_, whether to pre-style heading content with a '.panel-title' class. Defaults to `false`. - `footerTitle`: _boolean_, whether to pre-style footer content with a '.panel-title' class. Defaults to `false`. |
$type | string | the panel type which can be one of the bootstrap color modifier constants. Defaults to [[TYPE_DEFAULT]]. - [[TYPE_DEFAULT]] or `default` - [[TYPE_PRIMARY]] or `primary` - [[TYPE_SUCCESS]] or `success` - [[TYPE_INFO]] or `info` - [[TYPE_WARNING]] or `warning` - [[TYPE_DANGER]] or `danger` |
$options | array | HTML attributes / options for the panel container |
$prefix | string | the CSS prefix for panel type. Defaults to `panel panel-`. |
return | string |
public static radioButtonGroup ( string $name, string | array $selection = null, array $items = [], array $options = [] ) : string | ||
$name | string | the name attribute of each radio. |
$selection | string | array | the selected value(s). |
$items | array | the data item used to generate the radios. The array keys are the radio values, while the array values are the corresponding labels. |
$options | array | options (name => config) for the radio list container tag. The following options are specially handled: - `tag`: _string_, the tag name of the container element. - `unselect`: _string_, the value that should be submitted when none of the radio buttons is selected. By setting this option, a hidden input will be generated. - `encode`: boolean, whether to HTML-encode the radio button labels. Defaults to `true`. This option is ignored if `item` option is set. - `separator`: _string_, the HTML code that separates items. - `itemOptions`: _array_, the options for generating the radio button tag using [[radio()]]. - `item`: _Closure_, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ~~~ function ($index, $label, $name, $checked, $value) ~~~ where `$index` is the zero-based index of the radio button in the whole list; `$label` is the label for the radio button; and `$name`, `$value` and `$checked` represent the name, value and the checked status of the radio button input. See [[renderTagAttributes()]] for details on how attributes are being rendered. |
return | string | the generated radio button group |
public static well ( string $content, string $size = '', array $options = [] ) : string | ||
$content | string | the content |
$size | string | the well size. Should be one of the bootstrap size modifiers: - [[SIZE_TINY]] or `xs` - [[SIZE_SMALL]] or `sm` - [[SIZE_MEDIUM]] or `md` - [[SIZE_LARGE]] or `lg` |
$options | array | HTML attributes / options for the well container. |
return | string |