I have a dropdown list that gets data from a function, the function pulls a list of all files in a certain folder. However, i need to capture the value of the file name, so i need to output the array with both value and name. Here's my code;
function in model;
public static function getEmailNewUserView() {
$files = CFileHelper::findFiles(Yii::getPathOfAlias('webroot.themes.'.Yii::app()->name.'.views.mail'), array('absolutePaths'=>false));
return $files;
}
HTML element in _form
<?php echo $form->dropDownListGroup(
$model,
'email_newuser_view',
array(
'wrapperHtmlOptions' => array(
'class' => 'col-md-6',
),
'widgetOptions' => array(
'data' => Options::model()->getEmailNewUserView(),
)
)
); ?>
This outputs;
<option value="0">item</option>
I need it it output
<option value="item">item</option>
Anyone know how to do this in Yii?