Final Class Yiisoft\Yii\DataView\ListView\ListItemContext
| Inheritance | Yiisoft\Yii\DataView\ListView\ListItemContext |
|---|
ListItemContext provides contextual information about the current item being rendered in a Yiisoft\Yii\DataView\ListView\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\Yii\DataView\ListView\ListView The widget that creates and uses this context.
Public Properties
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Yii\DataView\ListView\ListItemContext |
Property Details
Method Details
| public __construct( array|object $data, integer|string $key, integer $index, Yiisoft\Yii\DataView\ListView\ListView $widget ): mixed | ||
| $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\Yii\DataView\ListView\ListView |
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,
) {}
Signup or Login in order to comment.