function entityreference_dragdrop_get_available_options in Entity Reference Drag & Drop 7
Returns available options.
1 call to entityreference_dragdrop_get_available_options()
File
- ./
entityreference_dragdrop.module, line 185 - Provides a Drag & Drop widget for entity-reference fields.
Code
function entityreference_dragdrop_get_available_options($items, $options) {
// Build an array of available items in id => label format.
$available = array();
foreach ($options as $bundle => $entities) {
foreach ($entities as $id => $label) {
$is_available = TRUE;
foreach ($items as $item) {
if ($id == $item['target_id']) {
$is_available = FALSE;
}
}
if ($is_available) {
$available[$id] = $label;
}
}
}
return $available;
}