widgets\DetailView $attributes

$attributes public property

A list of attributes to be displayed in the detail view. Each array element represents the specification for displaying one particular attribute.

An attribute can be specified as a string in the format of attribute, attribute:format or attribute:format:label, where attribute refers to the attribute name, and format represents the format of the attribute. The format is passed to the yii\i18n\Formatter::format() method to format an attribute value into a displayable text. Please refer to yii\i18n\Formatter for the supported types. Both format and label are optional. They will take default values if absent.

An attribute can also be specified in terms of an array with the following elements:

  • attribute: the attribute name. This is required if either label or value is not specified.
  • label: the label associated with the attribute. If this is not specified, it will be generated from the attribute name.
  • value: the value to be displayed. If this is not specified, it will be retrieved from $model using the attribute name by calling yii\helpers\ArrayHelper::getValue(). Note that this value will be formatted into a displayable text according to the format option.
  • format: the type of the value that determines how the value would be formatted into a displayable text. Please refer to yii\i18n\Formatter for supported types.
  • visible: whether the attribute is visible. If set to false, the attribute will NOT be displayed.
  • contentOptions: the HTML attributes to customize value tag. For example: ['class' => 'bg-red']. Please refer to yii\helpers\BaseHtml::renderTagAttributes() for the supported syntax.
  • captionOptions: the HTML attributes to customize label tag. For example: ['class' => 'bg-red']. Please refer to yii\helpers\BaseHtml::renderTagAttributes() for the supported syntax.
public array $attributes = null
doc_Yii
2016-10-30 17:18:15
Comments
Leave a Comment

Please login to continue.