1 | <?php |
||
53 | class DetailView extends GridView |
||
54 | { |
||
55 | /** |
||
56 | * @var array|object the data model whose details are to be displayed. This can be a [[Model]] instance, |
||
57 | * an associative array, an object that implements [[Arrayable]] interface or simply an object with defined |
||
58 | * public accessible non-static properties. |
||
59 | */ |
||
60 | public $model; |
||
61 | /** |
||
62 | * @var string|callable the template used to render a single attribute. If a string, the token `{label}` |
||
63 | * and `{value}` will be replaced with the label and the value of the corresponding attribute. |
||
64 | * If a callback (e.g. an anonymous function), the signature must be as follows: |
||
65 | * |
||
66 | * ```php |
||
67 | * function ($attribute, $index, $widget) |
||
68 | * ``` |
||
69 | * |
||
70 | * where `$attribute` refer to the specification of the attribute being rendered, `$index` is the zero-based |
||
71 | * index of the attribute in the [[attributes]] array, and `$widget` refers to this widget instance. |
||
72 | */ |
||
73 | public $template = '<tr>{label}{value}</tr>'; |
||
74 | /** |
||
75 | * @var array the HTML attributes for the container tag of this widget. The "tag" option specifies |
||
76 | * what container tag should be used. It defaults to "table" if not set. |
||
77 | * |
||
78 | * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
||
79 | */ |
||
80 | public $options = ['class' => 'table table-striped table-bordered table-condensed detail-view']; |
||
81 | |||
82 | /** |
||
83 | * Initializes dataProvider. |
||
84 | */ |
||
85 | public function init() |
||
94 | |||
95 | /** |
||
96 | * Renders the detail view. |
||
97 | * This is the main entry of the whole detail view rendering. |
||
98 | */ |
||
99 | public function run() |
||
110 | |||
111 | /** |
||
112 | * Renders a single column. |
||
113 | * |
||
114 | * @param DataColumn $column the specification of the column to be rendered |
||
115 | * @param int $index the zero-based index of the column in the [[columns]] array |
||
116 | * |
||
117 | * @return string the rendering result |
||
118 | */ |
||
119 | protected function renderColumn($column, $index) |
||
130 | |||
131 | /** |
||
132 | * @var GridView object to be used for DataColumn creation |
||
133 | */ |
||
134 | public $grid; |
||
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | protected function createDataColumn($text) |
||
147 | } |
||
148 |