/** * Renders the element widget returning html * * @param array $attributes * @return string */ public function render($attributes = array()) { $attrs = $this->getAttributes(); if (array_key_exists('using', $attrs)) { $options = []; list($key, $value) = $attrs['using']; foreach ($this->getOptions()->toArray() as $s) { $options[$s[$key]] = \Phalcon\DI::getDefault()->getTrans()->query($this->transPrefix . $s[$value]); } $this->setOptions($options); } return parent::render($attributes); }
public function testCorrectlyAddOptionToSelectElementIfParameterIsAString() { $element = new Select('test-select'); $element->addOption('value'); $this->assertEquals('<select id="test-select" name="test-select"><option value="0">value</option></select>', preg_replace('/[[:cntrl:]]/', '', $element->render())); }