Final Class Yiisoft\Yii\DataView\ListView\ListItemContext
| Inheritance | Yiisoft\ |
|---|
ListItemContext provides contextual information about the current item being rendered in a {@see ListView}.
This immutable data class encapsulates all the contextual information needed when rendering individual list items, making it available to closures and view templates.
See also Yiisoft\
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $data | array|object | Yiisoft\ |
|
| $index | integer | Yiisoft\ |
|
| $key | int|string | Yiisoft\ |
|
| $widget | Yiisoft\ |
Yiisoft\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
Property Details
Method Details
| public mixed __construct ( array|object $data, integer|string $key, integer $index, Yiisoft\ | ||
| $data | array|object |
The current data being rendered. This can be either an array or an object representing the current item's data. |
| $key | integer|string |
The key value associated with the current data. This is typically used as a unique identifier for the item and can be either an integer or a string. |
| $index | integer |
The zero-based index of the data in the array. This represents the item's position in the overall dataset, starting from 0. |
| $widget | Yiisoft\ |
The list view object that is rendering the current item. This provides access
to the |
public function __construct(
public readonly array|object $data,
public readonly int|string $key,
public readonly int $index,
public readonly ListView $widget,
) {}
User Contributed Notes
Leave a comment
Join the conversation to share a note.