I need to conditionally add an option to an existing form field in my custom component. The form is defined in models/forms/myview.xml like:
<form> <fieldset> ... <field name="myfield" type="list" ... > <option value="none">JNONE</option> <option value="one">one</option> <option value="two">two</option> </field> ...
How can I add an additional option "something-else" to myfield in views/myview/view.html.php?
I suppose I need to use
$this->form->setFieldAttribute(...), but I cannot get it to work.
Update: (almost there) looks like I can add options with
$this->form->getField('myfield')->addOption("foo"), but I cannot set a key-value pair here.