PHP Class unclead\multipleinput\components\BaseColumn

Inheritance: extends yii\base\Object
Show file Open project: unclead/yii2-multiple-input Class Usage Examples

Public Properties

Property Type Description
$attributeOptions client-side options of the attribute, e.g. enableAjaxValidation. You can use this property for custom configuration of the column (attribute). By default, the column will use options which are defined on widget level.
$context the context of using a column. It is an instance of widget(MultipleInput or TabularInput).
$defaultValue default value for input
$enableError whether to render inline error for the input. Default to false
$errorOptions the default options for the error tag
$headerOptions the HTML attributes for the header cell tag.
$items items which used for rendering input with multiple choice, e.g. dropDownList. It can be an array or anonymous function with following signature: 'columns' => [ ... [ 'name' => 'column', 'items' => function($data) { do your magic } .... ] ...
$name input name
$options array
$renderer the renderer instance
$title the header cell content. Note that it will not be HTML-encoded.
$type input type
$value string | Closure

Public Methods

Method Description
getElementId ( null | integer $index = null ) : mixed Returns element id.
getElementName ( integer | null $index, boolean $withPrefix = true ) : string Returns element's name.
getFirstError ( $index ) : mixed
getModel ( ) : Model | yii\db\ActiveRecordInterface | array
init ( )
isHiddenInput ( ) : boolean
renderError ( string $error ) : string Renders an error.
renderInput ( string $name, array $options ) : string Renders the input.
setModel ( Model | yii\db\ActiveRecordInterface | array $model )

Protected Methods

Method Description
ensureModel ( $model )
isEmpty ( $value )
prepareValue ( ) : mixed Prepares the value of column.
renderCheckbox ( string $name, mixed $value, array $options ) : string Renders checkbox.
renderCheckboxList ( string $name, mixed $value, array $options ) : string Renders checkbox list.
renderDefault ( $name, $value, $options ) : string Renders an input.
renderDropDownList ( $name, $value, $options ) : string Renders drop down list.
renderHiddenInput ( string $name, mixed $value, array $options ) : string Renders hidden input.
renderListBox ( string $name, mixed $value, array $options ) : string Renders list box.
renderRadio ( string $name, mixed $value, array $options ) : string Renders radio button.
renderRadioList ( string $name, mixed $value, array $options ) : string Renders radio button list.
renderStatic ( $name, $value, $options ) : string
renderWidget ( $type, $name, $value, $options ) : mixed Renders a widget.

Private Methods

Method Description
normalize ( $name ) : mixed Normalization name.
prepareItems ( mixed $items ) : array | Closur\Closure | mixed Returns the items for list.

Method Details

ensureModel() protected method

protected ensureModel ( $model )

getElementId() public method

Returns element id.
public getElementId ( null | integer $index = null ) : mixed
$index null | integer
return mixed

getElementName() abstract public method

Returns element's name.
abstract public getElementName ( integer | null $index, boolean $withPrefix = true ) : string
$index integer | null current row index
$withPrefix boolean whether to add prefix.
return string

getFirstError() abstract public method

abstract public getFirstError ( $index ) : mixed
$index
return mixed

getModel() public method

public getModel ( ) : Model | yii\db\ActiveRecordInterface | array
return yii\base\Model | yii\db\ActiveRecordInterface | array

init() public method

public init ( )

isEmpty() protected method

protected isEmpty ( $value )

isHiddenInput() public method

public isHiddenInput ( ) : boolean
return boolean whether the type of column is hidden input.

prepareValue() protected method

Prepares the value of column.
protected prepareValue ( ) : mixed
return mixed

renderCheckbox() protected method

Renders checkbox.
protected renderCheckbox ( string $name, mixed $value, array $options ) : string
$name string the name of input
$value mixed the value of input
$options array the HTMl options of input
return string

renderCheckboxList() protected method

Renders checkbox list.
protected renderCheckboxList ( string $name, mixed $value, array $options ) : string
$name string the name of input
$value mixed the value of input
$options array the HTMl options of input
return string

renderDefault() protected method

Renders an input.
protected renderDefault ( $name, $value, $options ) : string
$name
$value
$options
return string

renderDropDownList() protected method

Renders drop down list.
protected renderDropDownList ( $name, $value, $options ) : string
$name
$value
$options
return string

renderError() public method

Renders an error.
public renderError ( string $error ) : string
$error string
return string

renderHiddenInput() protected method

Renders hidden input.
protected renderHiddenInput ( string $name, mixed $value, array $options ) : string
$name string the name of input
$value mixed the value of input
$options array the HTMl options of input
return string

renderInput() public method

Renders the input.
public renderInput ( string $name, array $options ) : string
$name string the name of the input
$options array the HTML options of input
return string

renderListBox() protected method

Renders list box.
protected renderListBox ( string $name, mixed $value, array $options ) : string
$name string the name of input
$value mixed the value of input
$options array the HTMl options of input
return string

renderRadio() protected method

Renders radio button.
protected renderRadio ( string $name, mixed $value, array $options ) : string
$name string the name of input
$value mixed the value of input
$options array the HTMl options of input
return string

renderRadioList() protected method

Renders radio button list.
protected renderRadioList ( string $name, mixed $value, array $options ) : string
$name string the name of input
$value mixed the value of input
$options array the HTMl options of input
return string

renderStatic() protected method

protected renderStatic ( $name, $value, $options ) : string
$name
$value
$options
return string

renderWidget() protected method

Renders a widget.
protected renderWidget ( $type, $name, $value, $options ) : mixed
$type
$name
$value
$options
return mixed

setModel() public method

public setModel ( Model | yii\db\ActiveRecordInterface | array $model )
$model yii\base\Model | yii\db\ActiveRecordInterface | array

Property Details

$attributeOptions public property

client-side options of the attribute, e.g. enableAjaxValidation. You can use this property for custom configuration of the column (attribute). By default, the column will use options which are defined on widget level.
Since: 2.1
public $attributeOptions

$context public property

the context of using a column. It is an instance of widget(MultipleInput or TabularInput).
public $context

$defaultValue public property

default value for input
public $defaultValue

$enableError public property

whether to render inline error for the input. Default to false
public $enableError

$errorOptions public property

the default options for the error tag
public $errorOptions

$headerOptions public property

the HTML attributes for the header cell tag.
public $headerOptions

$items public property

items which used for rendering input with multiple choice, e.g. dropDownList. It can be an array or anonymous function with following signature: 'columns' => [ ... [ 'name' => 'column', 'items' => function($data) { do your magic } .... ] ...
public $items

$name public property

input name
public $name

$options public property

public array $options
return array

$renderer public property

the renderer instance
public $renderer

$title public property

the header cell content. Note that it will not be HTML-encoded.
public $title

$type public property

input type
public $type

$value public property

public string|Closure $value
return string | Closure