/** * Displays the select component. * * @param array $attributes The opt:display attribute list. */ public function display($attributes = array()) { $attributes = array('name' => $this->_item->getFullyQualifiedName(), 'class' => Opf_Design::getClass('select', $this->_item->isValid())); $code = '<select ' . Opt_Function::buildAttributes($attributes) . '>'; foreach ($this->_options as $id => $option) { if ($id == $this->_item->getValue()) { $code .= '<option value="' . $id . '" selected="selected">' . $option . '</option>'; } else { $code .= '<option value="' . $id . '">' . $option . '</option>'; } } echo $code . '</select>'; }
/** * Displays the input component. * * @param array $attributes The opt:display attribute list. */ public function display($attributes = array()) { $attributes = array('name' => $this->_item->getFullyQualifiedName(), 'value' => $this->_item->getDisplayedValue(), 'class' => Opf_Design::getClass('input', $this->_item->isValid())); echo '<input type="text" ' . Opt_Function::buildAttributes($attributes) . ' />'; }