protected function _selectOptions(array $list, array $scope)
{
$result = "";
foreach ($list as $value => $title) {
if (is_array($title)) {
$label = $value;
$options = array();
$raw = $this->_selectOptions($title, $scope);
$params = compact('label', 'options', 'raw');
$result .= $this->_render('select', 'option-group', $params);
continue;
}
$selected = is_array($scope['value']) && in_array($value, $scope['value']) || $scope['empty'] && empty($scope['value']) && $value === '' || is_scalar($scope['value']) && (string) $scope['value'] === (string) $value;
$options = $selected ? array('selected' => true) : array();
$params = compact('value', 'title', 'options');
$result .= $this->_render('select', 'select-option', $params);
}
return $result;
}