{
"type": "select",
"label": "Select",
"className": "form-control",
"name": "select-1511596175604",
"values": [
{
"label": "Option 1",
"value": "option-1",
"selected": true
},
{
"label": "Option 2",
"value": "option-2"
},
{
"label": "Option 3",
"value": "option-3"
}
]
}
switch ($element->type) {
case 'select':
$selectElement = new Select($element->name);
$selectElement->setAttribute('class', $element->className);
foreach ($element->values as $option) {
$options = array(
$option->label => $option->value
);
$selectElement->setValueOptions($options);
}
$form->add($selectElement);
break;
}