HtmlElementBsDropdown
extends HtmlElement
in package
Table of Contents
Properties
- $button : mixed
- $menu : mixed
- $parent : mixed
- $attributes : mixed
- $content : mixed
- $params : mixed
- $tag : mixed
- $direction : mixed
- $directions : mixed
- $drop : mixed
- $drops : mixed
Methods
- __construct() : HtmlElementBsDropdown
- attributes() : HtmlElement
- Add new attributes to element
- button() : mixed
- childContent() : mixed
- content() : string
- Set the element content and return the formated element as a string
- dispatch() : mixed
- Display the content
- element() : object
- Call a new class which extend current HtmlElementClass
- menu() : mixed
- parseParam() : mixed
- tag() : HtmlElement
- Instantiate a new object using tag name
- use() : string
- Return the formated element as a string
- child() : HtmlElement
- Instantiate a child element
- parseAttributes() : string
- Convert Attributes from array to a scring
- parseContent() : string|array<string|int, mixed>|null
- Convert the content from array to string
- setAttrClass() : mixed
- setAttributeByParam() : mixed
- baseClass() : mixed
- buttonData() : mixed
- getTemplateByTag() : string
- Return the template use to format the element
- menuClass() : mixed
- menuItem() : mixed
- parseParams() : mixed
- setAttributes() : mixed
- setContent() : mixed
- setMenuItems() : mixed
Properties
$button
public
mixed
$button
$menu
public
mixed
$menu
$parent
public
mixed
$parent
$attributes
protected
mixed
$attributes
$content
protected
mixed
$content
$params
protected
mixed
$params
$tag
protected
mixed
$tag
$direction
private
mixed
$direction
$directions
private
mixed
$directions
= ['center', 'end', 'start']
$drop
private
mixed
$drop
$drops
private
mixed
$drops
= ['down', 'end', 'start', 'up']
Methods
__construct()
public
__construct([array<string|int, mixed> $params = [] ]) : HtmlElementBsDropdown
Parameters
- $params : array<string|int, mixed> = []
-
the values are optional and must be: |- autoclose = true | inside | outside | false Auto close behavior |- button = the trigger bs button element, arrow in case of split |- dark = false | true = menu is dark |- direction = the menu display direction |- drop = down | end | start | up - the drop direction |- menu = the bs element of menu |- align (end | start | end + start responsive) |- items = array of items (type, text, active, disabled) |- button (text, type = button) |- header (text, type = header) |- html (content, type = html) |- link (href, type = link, text) |- separator (tag, type = separator) |- text (text, type = text) |- tag (default is ul - also is set based on item types) |- offset = false | $value in pixels |- reference = false | parent |- split = the bs button split -
Return values
HtmlElementBsDropdownattributes()
Add new attributes to element
public
attributes([array<string|int, mixed>|null $attributes = [] ][, bool $mergeValues = true ]) : HtmlElement
Parameters
- $attributes : array<string|int, mixed>|null = []
-
The the attributes must be included in one array, each member having any of the following format:
- single attribute: $attributes = ['disabled']
- associative: $atributes = ['type'=>'input', 'value'=>3]
- associative multiple keys: $attributes = ['data' => ['role' => 'content', 'content' => 'button']]
- assocuative multiple values: $attributes = ['class' => 'btn btn-sm']
- $mergeValues : bool = true
-
- merge new values true | false
Return values
HtmlElementbutton()
public
button([mixed $params = 'Dropdown button' ]) : mixed
Parameters
- $params : mixed = 'Dropdown button'
childContent()
public
childContent(mixed $name[, mixed $return = false ]) : mixed
Parameters
- $name : mixed
- $return : mixed = false
content()
Set the element content and return the formated element as a string
public
content([array<string|int, mixed>|string|null $content = null ][, mixed $return = false ]) : string
Parameters
- $content : array<string|int, mixed>|string|null = null
- $return : mixed = false
Return values
stringdispatch()
Display the content
public
dispatch([array<string|int, mixed>|string|null $content = null ]) : mixed
Parameters
- $content : array<string|int, mixed>|string|null = null
element()
Call a new class which extend current HtmlElementClass
public
element(string $element[, array<string|int, mixed>|string $properties = [] ][, mixed $root = null ]) : object
Parameters
- $element : string
-
- defined element
- $properties : array<string|int, mixed>|string = []
- $root : mixed = null
Return values
object —defeined in extended class
menu()
public
menu([mixed $params = [] ]) : mixed
Parameters
- $params : mixed = []
parseParam()
public
parseParam(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
tag()
Instantiate a new object using tag name
public
tag(string|null $tag[, mixed $attributes = null ][, mixed $newElement = true ][, mixed $instance = null ]) : HtmlElement
Parameters
- $tag : string|null
-
element tag
- $attributes : mixed = null
- $newElement : mixed = true
- $instance : mixed = null
Return values
HtmlElementuse()
Return the formated element as a string
public
use() : string
Return values
stringchild()
Instantiate a child element
protected
child(string $name, string $type[, array<string|int, mixed> $defaultAttributes = [] ]) : HtmlElement
Parameters
- $name : string
-
- the child name
- $type : string
-
- the element type | html-tag
- $defaultAttributes : array<string|int, mixed> = []
Return values
HtmlElementparseAttributes()
Convert Attributes from array to a scring
protected
parseAttributes() : string
Return values
stringparseContent()
Convert the content from array to string
protected
parseContent() : string|array<string|int, mixed>|null
Return values
string|array<string|int, mixed>|nullsetAttrClass()
protected
setAttrClass(mixed $value[, mixed $merge = true ]) : mixed
Parameters
- $value : mixed
- $merge : mixed = true
setAttributeByParam()
protected
setAttributeByParam(mixed $key) : mixed
Parameters
- $key : mixed
baseClass()
private
baseClass() : mixed
buttonData()
private
buttonData() : mixed
getTemplateByTag()
Return the template use to format the element
private
getTemplateByTag() : string
Return values
stringmenuClass()
private
menuClass() : mixed
menuItem()
private
menuItem([array<string|int, mixed>|string $item = [] ]) : mixed
Parameters
- $item : array<string|int, mixed>|string = []
parseParams()
private
parseParams() : mixed
setAttributes()
private
setAttributes() : mixed
setContent()
private
setContent() : mixed
setMenuItems()
private
setMenuItems() : mixed