Menu

## Accordion
in package

Accordion.php : 18

Accordion class for creating HTML accordions.

##### Tags

see
  https://www.kotchasan.com/

### Table of Contents

$datas : mixed
  Array of accordion items.
$id : mixed
  ID of the accordion. Must be unique.
$type : mixed
  Type of accordion (radio or checkbox).
__construct() : mixed
  Constructor.
add() : mixed
  Add an item to the accordion.
render() : string
  Generate the HTML code for the accordion.

### Properties

#### $datas

Accordion.php : 25

Array of accordion items.

`private mixed $datas`

#### $id

Accordion.php : 32

ID of the accordion. Must be unique.

`private mixed $id`

#### $type

Accordion.php : 39

Type of accordion (radio or checkbox).

`private mixed $type`

### Methods

#### __construct()

Accordion.php : 48

Constructor.

`public __construct(string $id[, array<string|int, mixed> $items = [] ][, bool $onetab = false ]) : mixed`

##### Parameters

$id : string

  ID of the accordion (must be unique).

$items : array<string|int, mixed> = []

  Initial items array (array(array('title1' => 'detail1'), array('title2' => 'detail2'))).

$onetab : bool = false

  true to allow opening only one tab at a time, false (default) to allow opening and closing tabs independently.

##### Return values

mixed —

#### add()

Accordion.php : 63

Add an item to the accordion.

`public add(string $title, string $detail[, bool $select = false ][, string $className = 'article' ]) : mixed`

##### Parameters

$title : string

  Title of the item.

$detail : string

  Details of the item.

$select : bool = false

  true to display this item, false (default) otherwise.

$className : string = 'article'

  CSS class for the item's content container. Use "article" as default if not specified.

##### Return values

mixed —

#### render()

Accordion.php : 77

Generate the HTML code for the accordion.

`public render() : string`

##### Return values

string —

HTML code for the accordion.

## Search results