diff --git a/src/Element/Select.php b/src/Element/Select.php index 1fdf799..8fe8e79 100644 --- a/src/Element/Select.php +++ b/src/Element/Select.php @@ -54,6 +54,19 @@ public function __construct($name, $values, $selected = null, $xmlFile = null, $ $this->setIndent($indent); } + $this->setValues($values); + } + + /** + * Set the options values of the select form element + * + * @param string|array $values + * @param string $xmlFile + * @param string $indent + * @return Select + */ + public function setValues($values, $xmlFile = null, $indent = null) + { $values = self::parseValues($values, $xmlFile); // Create the child option elements. @@ -90,6 +103,8 @@ public function __construct($name, $values, $selected = null, $xmlFile = null, $ $this->addChild($option); } } + + return $this; } /**