Trait kartik\base\AddonTrait
AddonTrait includes methods to render bootstrap styled addons based on the addon property in classes that
use this trait.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $addon | array | Addon to prepend or append to the widget (based on bootstrap input group styling). | kartik\base\AddonTrait |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getAddonContent() | Parses and returns addon content. | kartik\base\AddonTrait |
| renderAddonItem() | Renders an addon item based on its configuration | kartik\base\AddonTrait |
Property Details
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 tofalse`.
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 tofalse`.
preCaption: array|string, the addon content placed before the caption. Note that this property is applicable for kartik\base\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 contentasButton: boolean, whether the addon is a buttonoptions: _array the HTML attributes for the append addon
contentBefore: string, content placed before the addoncontentAfter: string, content placed after the addongroupOptions: array, HTML options for the input group
Method Details
Parses and returns addon content.
| protected string getAddonContent ( $type, $bsVer = null ) | ||
| $type | string | The addon type |
| $bsVer | integer|null | Bootstrap version |
| throws | Exception | |
|---|---|---|
Renders an addon item based on its configuration
| protected static string renderAddonItem ( $config, $bsVer = null ) | ||
| $config | array | The addon item configuration |
| $bsVer | integer|null | Bootstrap version |
| throws | Exception | |
|---|---|---|