options = $options; } public function render() { $options = array(); foreach( $this->options as $k => $v ){ if( ! strlen($k) ){ if( $this->getAttr('required') ){ } else { $k = ' '; } } $this_input = $this->htmlFactory->makeElement('option', $v) ->addAttr('value', $k ) ; if( $k == $this->value ){ $this_input ->addAttr('selected', 'selected') ; } $options[] = $this_input; } $options = $this->htmlFactory->makeCollection( $options ); $out = $this->htmlFactory->makeElement('select', $options) ->addAttr('name', $this->htmlName() ) ->addAttr('class', 'hc-field') // ->addAttr('class', 'hc-block') ->addAttr('class', 'hc-full-width') ; $attr = $this->getAttr(); foreach( $attr as $k => $v ){ $out->addAttr( $k, $v ); } if( strlen($this->label) ){ $out = $this->htmlFactory->makeLabelled( $this->label, $out, $this->htmlId() ); } return $out; } }