<select name="<?php echo $this->escape($this->name) . ($this->isMultiple ? '[]' : ''); ?>"<?php echo $this->attr; ?>>
    <?php foreach ($this->options as $optionKey => $optionValue):
        $attr = '';
        if (is_array($optionValue)):
            if (array_key_exists('attr', $optionValue)):
                foreach ($optionValue['attr'] as $key => $value):
                    $attr .= ' ' . $this->escape($key) . '="' . $this->escape($value) . '"';
                endforeach;
            endif;
            $optionValue = $optionValue['name'];
        endif;
?>
        <option value="<?php echo $this->escape($optionKey); ?>"
            <?php echo ((is_array($this->value) && in_array($optionKey, $this->value)) ||
                (!is_array($this->value) && $optionKey == $this->value) ? ' selected' : '') . $attr; ?>>
            <?php echo $this->escape($optionValue); ?>
        </option>
    <?php endforeach; ?>
</select>
