public function getHtmlElement() { $el = new Element('input', ['type' => 'number', 'name' => $this->getName(), 'value' => $this->getValue()]); if ($this->hasOption('min')) { $el->setAttribute('min', $this->getOption('min')); } if ($this->hasOption('max')) { $el->setAttribute('max', $this->getOption('max')); } if ($this->hasOption('step')) { $el->setAttribute('step', $this->getOption('step')); } return $el; }
public function getHtmlElement() { $el = new Element('select', ['name' => $this->getName()]); foreach ($this->getConfig() as $value => $label) { $option = new Element('option', ['value' => $value]); $option->setText($label); if (strval($value) === strval($this->getValue())) { $option->setAttribute('selected', true); } $el->appendChild($option); } return $el; }