protected function _render_specific($args) { extract(wp_parse_args($args, array('text' => false, 'extra' => array()))); $options = array(); if (false !== $text) { $options[] = array('value' => '', 'selected' => $selected == array('foo'), 'title' => $text); } foreach ($choices as $value => $title) { $options[] = array('value' => $value, 'selected' => $value == $selected, 'title' => $title); } $opts = ''; foreach ($options as $option) { extract($option); $opts .= html('option', compact('value', 'selected'), $title); } $extra['name'] = $name; $input = html('select', $extra, $opts); return scbFormField::add_label($input, $desc, $desc_pos); }
/** * @param array $args * * @return string */ protected function _render_specific($args) { $args = wp_parse_args($args, array('text' => false, 'extra' => array())); $options = array(); if (false !== $args['text']) { $options[] = array('value' => '', 'selected' => $args['selected'] === array('foo'), 'title' => $args['text']); } foreach ($args['choices'] as $value => $title) { $value = (string) $value; $options[] = array('value' => $value, 'selected' => $value == $args['selected'], 'title' => $title); } $opts = ''; foreach ($options as $option) { $opts .= html('option', array('value' => $option['value'], 'selected' => $option['selected']), $option['title']); } $args['extra']['name'] = $args['name']; $input = html('select', $args['extra'], $opts); return scbFormField::add_label($input, $args['desc'], $args['desc_pos']); }