public function select($fieldName, $options = [], array $attributes = [])
{
$attributes += ['disabled' => null, 'escape' => true, 'hiddenField' => true, 'multiple' => null, 'secure' => true, 'empty' => false];
if ($attributes['multiple'] === 'checkbox') {
unset($attributes['multiple'], $attributes['empty']);
return $this->multiCheckbox($fieldName, $options, $attributes);
}
// Secure the field if there are options, or it's a multi select.
// Single selects with no options don't submit, but multiselects do.
if ($attributes['secure'] && empty($options) && empty($attributes['empty']) && empty($attributes['multiple'])) {
$attributes['secure'] = false;
}
$attributes = $this->_initInputField($fieldName, $attributes);
$attributes['options'] = $options;
$hidden = '';
if ($attributes['multiple'] && $attributes['hiddenField']) {
$hiddenAttributes = ['name' => $attributes['name'], 'value' => '', 'form' => isset($attributes['form']) ? $attributes['form'] : null, 'secure' => false];
$hidden = $this->hidden($fieldName, $hiddenAttributes);
}
unset($attributes['hiddenField'], $attributes['type']);
return $hidden . $this->widget('select', $attributes);
}