We have a custom fieldtype that can be attached to an entry type multiple times and everything works just fine. This fieldtype has multiple input fields (shortUrl, longUrl) and they have been properly namespaced to make them unique (via the fieldtype handle) and when the data is saved, it gets saved to a table that defines the necessary columns (id, elementId, shortUrl, longUrl) since the
defineContetAttribute() method has been set to false.
As previously mentioned, this fieldtype has been properly namespaced and is taking advantage of the Craft JS buffer to avoid naming conflicts.
The issue comes up when we try to retrieve the data from our custom table via
$value will be
null and all the other values we have access to in this context (
$field->element->id) are not unique enough to fetch a record.
I've tried a couple of workarounds but have not found a clean way to do this yet.
prepValue() method provides the entry id (
$field->element->id) which we can use to fetch the content (record) for each field since we have a relationship set but beyond that, I haven't found any other way to identify each record individually so that I can attach it to the right field instance within the input html.
There might be something simple that I'm missing and thought I would ask: )