AddonTrait
AddonTrait includes methods to render bootstrap styled addons based on the `addon` property in classes that use this trait.
Tags
Table of Contents
Properties
Methods
- getAddonContent() : string
- Parses and returns addon content.
- renderAddonItem() : string
- Renders an addon item based on its configuration
Properties
$addon
public
array<string|int, mixed>
$addon
$addon
public
array<string|int, mixed>
$addon
= []
addon to prepend or append to the widget (based on bootstrap input group styling).
-
prepend
: array|string, the prepend addon configuration. If set as a string will be rendered as is. If set as an array, the following properties can be set:-
content
: string, the prepend addon content. -
asButton
: _boolean, whether the addon is a button or button group. Defaults to
false`.
-
-
append
: array|string, the append addon configuration. If set as a string will be rendered as is. If set as an array, the following properties can be set:-
content
: string, the append addon content. -
asButton
: _boolean, whether the addon is a button or button group. Defaults to
false`.
-
-
preCaption
: array|string, the addon content placed before the caption. Note that this property is applicable for [[Html5Input]] widget only. If set as a string, will be rendered as a raw markup without HTML encoding. If set as an array, the following options can be set:-
content
: string, the append addon content -
asButton
: boolean, whether the addon is a button -
options
: _array the HTML attributes for the append addon
-
-
contentBefore
: string, content placed before the addon -
contentAfter
: string, content placed after the addon -
groupOptions
: array, HTML options for the input group
Methods
getAddonContent()
Parses and returns addon content.
protected
getAddonContent(string $type[, int|null $bsVer = null ]) : string
Parameters
- $type : string
-
the addon type
prepend
orappend
. If any other value is set, it will default toprepend
- $bsVer : int|null = null
-
bootstrap version
Tags
Return values
stringrenderAddonItem()
Renders an addon item based on its configuration
protected
static renderAddonItem(array<string|int, mixed> $config[, int|null $bsVer = null ]) : string
Parameters
- $config : array<string|int, mixed>
-
the addon item configuration
- $bsVer : int|null = null
-
bootstrap version