Custom fields - How to access field options inside `this.$updateValue`?

I try to modify some data inside a custom field. The simplified structure is:

  • data structure: (string) "1|2|5|8"
  • field options: {"separator": "|"}
this.$updateValue = function(value, field) {

    // value = (string) "1|2|5|8"
    // field = (string) "entry.my_field_name"

    if (typeof value == 'string') { // opts.separator is undefined
        value = value.split(opts.separator ? opts.separator : ',');
    }

    // some more checks...

    if (JSON.stringify(this.selected) != JSON.stringify(value)) {
        this.selected = value;
        this.update();
    }

}.bind(this);

How can I access the field options inside this function? It’s somehow defined in riot.bind.js, but I don’t understand it. I tried to assign variables in this.on('mount', ...), in this.on('update', ...), at the top of the script, with all variations of this.opts and $this.opts … nothing worked.

@artur Can you give me a hint, please?

it should be just opts

It seems, that opts aren’t really available, at this moment. Or maybe it’s my Firefox again… I solved the problem by casting the values as array in my find function. On the PHP side I had access to the options.

edit:
And some background… I resolved many-to-many relations from a SQL database with GROUP_CONCAT. For now there are only comma separated numeric id numbers, but it is possible to have different data and then I need to adjust the separator while fetching the data and while displaying it.