_hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId);
return $this->renderTreelist($models);
}
protected function renderTreelist($models) {
foreach ($models as $index => $model) {
$row = $this->renderTreelistItem($model['item']);
$children = empty($model['children']) ? '' : $this->renderTreelist($model['children']);
$output[] = '
'. $row . $children .'';
}
if (!empty($output))
return ''. implode("\n", $output) .'
';
}
protected function renderTreelistItem($model)
{
$options = [];
$id = ArrayHelper::getValue($model, $this->keyNameId);
Html::addCssClass($options, "treelistitem-$id");
$parent_id = ArrayHelper::getValue($model, $this->keyNameParentId);
if ($parent_id) {
Html::addCssClass($options, "treelistitem-parent-$parent_id");
}
// if (is_string($this->value)) {
// return ArrayHelper::getValue($model, $this->value);
// } else {
// return call_user_func($this->value, $model, $key, $index, $this);
// }
return Html::tag('span', ArrayHelper::getValue($model, $this->displayField), $options);
}
}