PHP Class yii\bootstrap\Collapse

For example: php echo Collapse::widget([ 'items' => [ equivalent to the above [ 'label' => 'Collapsible Group Item #1', 'content' => 'Anim pariatur cliche...', open its content by default 'contentOptions' => ['class' => 'in'] ], another group item [ 'label' => 'Collapsible Group Item #1', 'content' => 'Anim pariatur cliche...', 'contentOptions' => [...], 'options' => [...], ], if you want to swap out .panel-body with .list-group, you may use the following [ 'label' => 'Collapsible Group Item #1', 'content' => [ 'Anim pariatur cliche...', 'Anim pariatur cliche...' ], 'contentOptions' => [...], 'options' => [...], 'footer' => 'Footer' // the footer label in list-group ], ] ]);
See also: http://getbootstrap.com/javascript/#collapse
Since: 2.0
Author: Antonio Ramirez ([email protected])
Inheritance: extends yii\bootstrap\Widget
Afficher le fichier Open project: yiisoft/yii2-bootstrap Class Usage Examples

Méthodes publiques

Свойство Type Description
$encodeLabels whether the labels for header items should be HTML-encoded.
$items list of groups in the collapse widget. Each array element represents a single group with the following structure: - label: string, required, the group header label. - encode: boolean, optional, whether this label should be HTML-encoded. This param will override global $this->encodeLabels param. - content: array|string|object, required, the content (HTML) of the group - options: array, optional, the HTML attributes of the group - contentOptions: optional, the HTML attributes of the group's content

Méthodes publiques

Méthode Description
init ( ) Initializes the widget.
renderItem ( string $header, array $item, integer $index ) : string Renders a single collapsible item group
renderItems ( ) : string Renders collapsible items as specified on [[items]].
run ( ) Renders the widget.

Method Details

init() public méthode

Initializes the widget.
public init ( )

renderItem() public méthode

Renders a single collapsible item group
public renderItem ( string $header, array $item, integer $index ) : string
$header string a label of the item group [[items]]
$item array a single item from [[items]]
$index integer the item index as each item group content must have an id
Résultat string the rendering result

renderItems() public méthode

Renders collapsible items as specified on [[items]].
public renderItems ( ) : string
Résultat string the rendering result

run() public méthode

Renders the widget.
public run ( )

Property Details

$encodeLabels public_oe property

whether the labels for header items should be HTML-encoded.
public $encodeLabels

$items public_oe property

list of groups in the collapse widget. Each array element represents a single group with the following structure: - label: string, required, the group header label. - encode: boolean, optional, whether this label should be HTML-encoded. This param will override global $this->encodeLabels param. - content: array|string|object, required, the content (HTML) of the group - options: array, optional, the HTML attributes of the group - contentOptions: optional, the HTML attributes of the group's content
public $items