00001 <?php
00002
00003
00004
00005
00006
00007
00008 class InputWidgetSelectBase extends InputWidgetBase {
00009
00010
00011
00012 protected function render_input($attrs, $params, $name, $title, $value, $policy) {
00013 $options = Arr::get_item($attrs, 'options', array());
00014 $nodefault = Arr::get_item($attrs, 'nodefault', false);
00015 unset($attrs['options']);
00016 unset($attrs['nodefault']);
00017 if (empty($value) && $nodefault) {
00018
00019 $new_options = array('' => tr('Please choose...', 'core'));
00020 foreach($options as $key => $v) {
00021 $new_options[$key] = $v;
00022 }
00023 $options = $new_options;
00024 }
00025 $ret = html::select($name, $options, $value, $attrs);
00026 return $ret;
00027 }
00028 }