1 | <?php |
||
25 | class ListView extends BaseListView |
||
26 | { |
||
27 | /** |
||
28 | * @var array|Closure the HTML attributes for the container of the rendering result of each data model. |
||
29 | * This can be either an array specifying the common HTML attributes for rendering each data item, |
||
30 | * or an anonymous function that returns an array of the HTML attributes. The anonymous function will be |
||
31 | * called once for every data model returned by [[dataProvider]]. |
||
32 | * The "tag" element specifies the tag name of the container element and defaults to "div". |
||
33 | * If "tag" is false, it means no container element will be rendered. |
||
34 | * |
||
35 | * If this property is specified as an anonymous function, it should have the following signature: |
||
36 | * |
||
37 | * ```php |
||
38 | * function ($model, $key, $index, $widget) |
||
39 | * ``` |
||
40 | * |
||
41 | * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
||
42 | */ |
||
43 | public $itemOptions = []; |
||
44 | /** |
||
45 | * @var string|callable the name of the view for rendering each data item, or a callback (e.g. an anonymous function) |
||
46 | * for rendering each data item. If it specifies a view name, the following variables will |
||
47 | * be available in the view: |
||
48 | * |
||
49 | * - `$model`: mixed, the data model |
||
50 | * - `$key`: mixed, the key value associated with the data item |
||
51 | * - `$index`: integer, the zero-based index of the data item in the items array returned by [[dataProvider]]. |
||
52 | * - `$widget`: ListView, this widget instance |
||
53 | * |
||
54 | * Note that the view name is resolved into the view file by the current context of the [[view]] object. |
||
55 | * |
||
56 | * If this property is specified as a callback, it should have the following signature: |
||
57 | * |
||
58 | * ```php |
||
59 | * function ($model, $key, $index, $widget) |
||
60 | * ``` |
||
61 | */ |
||
62 | public $itemView; |
||
63 | /** |
||
64 | * @var array additional parameters to be passed to [[itemView]] when it is being rendered. |
||
65 | * This property is used only when [[itemView]] is a string representing a view name. |
||
66 | */ |
||
67 | public $viewParams = []; |
||
68 | /** |
||
69 | * @var string the HTML code to be displayed between any two consecutive items. |
||
70 | */ |
||
71 | public $separator = "\n"; |
||
72 | /** |
||
73 | * @var array the HTML attributes for the container tag of the list view. |
||
74 | * The "tag" element specifies the tag name of the container element and defaults to "div". |
||
75 | * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
||
76 | */ |
||
77 | public $options = ['class' => 'list-view']; |
||
78 | |||
79 | |||
80 | /** |
||
81 | * Renders all data models. |
||
82 | * @return string the rendering result |
||
83 | */ |
||
84 | 7 | public function renderItems() |
|
95 | |||
96 | /** |
||
97 | * Renders a single data model. |
||
98 | * @param mixed $model the data model to be rendered |
||
99 | * @param mixed $key the key value associated with the data model |
||
100 | * @param int $index the zero-based index of the data model in the model array returned by [[dataProvider]]. |
||
101 | * @return string the rendering result |
||
102 | */ |
||
103 | 7 | public function renderItem($model, $key, $index) |
|
127 | } |
||
128 |