Open FaimMedia opened 4 months ago
I might have to rewrite this component. There are a couple of features that are a bit difficult to use to get the result you need.
This code should do what you need to do:
$this->view->typeOptions = [
4 => 'Type 4',
8 => 'Type 8',
];
<div class="row row-label">
<label>Type:</label>
{% assign select = inputSelect(' ', PHP_EOL, ['name' : 'type', 'placeHolder' : 'Select type']) %}
{% for id, name in typeOptions %}
{{ select.add(name, id) }}
{% endfor %}
{{ select }}
</div>
I am thinking, in alignment with what you mention, to have more methods for this. For instance we can have a method setAttributes
to change whatever we like before the element is rendered and also have something like setOptions
that will accept the array (the same thing as using
)
I will work on this most likely this weekend.
Describe the bug Following this example: https://docs.phalcon.io/5.7/volt/#tag-helpers It shows you should place
inputSelect
in a loop chained to anadd
function to add options. Not surprisingly, this just spits out x number of select fields, with only one option (see screenshots). So obviously the documentation is wrong here, but reviewing the source, I cannot find a method for adding a list of options directly? (Phalcon 3.4 had ausing
option: https://docs.phalcon.io/3.4/volt/#using-tag-helpers). How to do this in Phalcon 5.7?To Reproduce Steps to reproduce the behavior:
Expected behavior One select field with provided multiple options.
Screenshots If applicable, add screenshots to help explain your problem.
Details