i got the following field in my form.xml-definition:
<field name="attachedto"
type="sql"
label="COM_BESTIA_FIELD_ATTACHEDTO"
query="SELECT id, title FROM #__bestia_items WHERE state = 1"
key_field="id"
value_field="title"
multiple="true"
required="false">
</field>
Now I would like to change the state = 1
according to the settings in the configuration of the component. If config says "use state = 0" the query should change from WHERE state = 1
to WHERE state = 0
.
How can I do that?