While developing my own Relation Select widget I discovered an issue with hook_field_is_empty($item, $field).
Your implementation calls the first parameter $items, suggesting that your implementation assumes that a list of items is given. However, a single item is handed to this function. I have replaced the implementation locally with the following, and it has been working fine for months with my widget. Could you check if it also works with the default widget?
function relation_select_field_is_empty($item, $field){
return empty($item['endpoints']);
}
Comments
Comment #1
Jorrit commentedThe tiny patch.
Comment #2
steveoliver commentedRe-rolled against HEAD, will test locally, encourage others to do the same (ALL those people watching this issue ;))
Comment #3
steveoliver commentedThis patch on it's own, against the latest 7.x-1.x, actually breaks the following functionality:
* Remove Relation Select field instance and associated Relation when endpoints are removed from RS field.
In other words, when I remove endpoints from an RS field, the relation needs to be deleted.
I suspect your patch is dependent upon another issue/patch you are working with... ?
Comment #4
Jorrit commentedThe reason I made the change was that I marked a relation instance as deleted by emptying the list of endpoints. I can set the entire relation instance to NULL as well, then your version works too. In any case, you may want to change the parameter
$itemsto$itembecause that is what Drupal is using.