Kotchasan

Tab
in package

Tab class to handle the creation and rendering of tabs.

Tags
see
https://www.kotchasan.com/

Table of Contents

$datas  : array<string|int, mixed>
$id  : string
$select  : string
$urls  : array<string|int, mixed>
__construct()  : mixed
Constructor
add()  : mixed
Add a tab item
getSelect()  : string
Get the ID of the selected tab
render()  : string
Generate the HTML code for rendering the tabs

Properties

$datas

private array<string|int, mixed> $datas

Array of tab items

$id

private string $id

Tab ID (must be unique)

$select

private string $select

Selected tab ID

$urls

private array<string|int, mixed> $urls

Array of URL components

Methods

__construct()

Constructor

public __construct(string $id, string $url[, array<string|int, mixed> $items = [] ]) : mixed
Parameters
$id : string

Tab ID (must be unique)

$url : string

URL of the current page (used as the default URL for the menu)

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

Array of initial tab items

Return values
mixed

add()

Add a tab item

public add(string $id, string $title[, string|null $url = '' ][, string|null $target = null ]) : mixed
Parameters
$id : string

Tab ID (used for selection)

$title : string

Text of the tab menu

$url : string|null = ''

URL to be opened when the tab is clicked

$target : string|null = null

Target attribute for the tab link

Return values
mixed

getSelect()

Get the ID of the selected tab

public getSelect() : string
Return values
string

render()

Generate the HTML code for rendering the tabs

public render([string $select = '' ]) : string
Parameters
$select : string = ''

ID of the selected tab (if empty, the first item will be selected)

Return values
string

Search results