Final Class Yiisoft\Yii\DataView\DetailView\DataField
| Inheritance | Yiisoft\Yii\DataView\DetailView\DataField |
|---|
DataField represents a field configuration for Yiisoft\Yii\DataView\DetailView\DetailView widget.
This class defines how a single field should be displayed in a Yiisoft\Yii\DataView\DetailView\DetailView
Public Properties
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Yii\DataView\DetailView\DataField |
Property Details
Method Details
| public __construct( string|null $property = null, string|null $label = null, boolean $labelEncode = true, array|Closure $labelAttributes = [], mixed $value = null, boolean|null $valueEncode = null, array|Closure $valueAttributes = [], array|Closure $fieldAttributes = [], boolean $visible = true ): mixed | ||
| $property | string|null |
Property name in the data object or key name in the data array. Optional if |
| $label | string|null |
Field label. If not set, |
| $labelEncode | boolean |
Whether the label is HTML encoded |
| $labelAttributes | array|Closure |
An array of label's HTML attribute values indexed by attribute names or a function accepting data and returning the array. * |
| $value | mixed |
The field value. It can be:
|
| $valueEncode | boolean|null |
Whether the value is HTML encoded. Supported values:
|
| $valueAttributes | array|Closure |
An array of value's HTML attribute values indexed by attribute names or a function accepting data and returning the array. |
| $fieldAttributes | array|Closure |
An array of label's HTML attribute values indexed by attribute names or a function accepting data and returning the array. |
| $visible | boolean |
Whether the field is visible. |
public function __construct(
public readonly ?string $property = null,
public readonly ?string $label = null,
public readonly bool $labelEncode = true,
public readonly array|Closure $labelAttributes = [],
public readonly mixed $value = null,
public readonly ?bool $valueEncode = null,
public readonly array|Closure $valueAttributes = [],
public readonly array|Closure $fieldAttributes = [],
public readonly bool $visible = true,
) {
if ($property === null && $value === null) {
throw new InvalidArgumentException('Either "property" or "value" must be set.');
}
}
Signup or Login in order to comment.