PHP Class yii2tech\admin\grid\VariationColumn

See also: https://github.com/yii2tech/ar-variation
Since: 1.0
Author: Paul Klimov ([email protected])
Inheritance: extends yii\grid\DataColumn
Mostra file Open project: yii2tech/admin

Public Properties

Property Type Description
$tableOptions the HTML attributes for the variation table element.
$variationAttribute name of the variation model attribute. If not set [[attribute]] value will be used.
$variationLabel variation label source. This should be either a string - variation option model attribute, which value should be used as variation label, or a callback of following signature: php function ($mainModel, $variationModel) { return string label }
$variationName model variation behavior name, which should be used by this column. It should refer to [[\yii2tech\ar\variation\VariationBehavior]] instance. If not set - model itself will be used for the method invocations.

Protected Methods

Method Description
getVariationBehavior ( Model $model ) : yii2tech\ar\variation\VariationBehavior Gets the variation behavior from model.
getVariationLabel ( Model | yii2tech\ar\variation\VariationBehavior $mainModel, Model $variationModel ) : string Returns the variation label.
getVariationLabels ( Model $mainModel, string $labelAttribute ) : array Returns all available variation labels.
getVariationValue ( Model $variationModel ) : string Returns the variation value.
renderDataCellContent ( $model, $key, $index )

Method Details

getVariationBehavior() protected method

Gets the variation behavior from model.
protected getVariationBehavior ( Model $model ) : yii2tech\ar\variation\VariationBehavior
$model yii\base\Model model instance.
return yii2tech\ar\variation\VariationBehavior variation behavior instance.

getVariationLabel() protected method

Returns the variation label.
protected getVariationLabel ( Model | yii2tech\ar\variation\VariationBehavior $mainModel, Model $variationModel ) : string
$mainModel yii\base\Model | yii2tech\ar\variation\VariationBehavior main model instance.
$variationModel yii\base\Model variation model instance.
return string label.

getVariationLabels() protected method

Returns all available variation labels.
protected getVariationLabels ( Model $mainModel, string $labelAttribute ) : array
$mainModel yii\base\Model main model instance.
$labelAttribute string name of the attribute, which is used as label source.
return array list labels in format: optionPk => label

getVariationValue() protected method

Returns the variation value.
protected getVariationValue ( Model $variationModel ) : string
$variationModel yii\base\Model variation model instance.
return string value.

renderDataCellContent() protected method

protected renderDataCellContent ( $model, $key, $index )

Property Details

$tableOptions public_oe property

the HTML attributes for the variation table element.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $tableOptions

$variationAttribute public_oe property

name of the variation model attribute. If not set [[attribute]] value will be used.
public $variationAttribute

$variationLabel public_oe property

variation label source. This should be either a string - variation option model attribute, which value should be used as variation label, or a callback of following signature: php function ($mainModel, $variationModel) { return string label }
public $variationLabel

$variationName public_oe property

model variation behavior name, which should be used by this column. It should refer to [[\yii2tech\ar\variation\VariationBehavior]] instance. If not set - model itself will be used for the method invocations.
public $variationName