function panopoly_widgets_field_prepare_view in Panopoly Widgets 7
Implements hook_field_prepare_view().
File
- ./
panopoly_widgets.spotlight.inc, line 441 - A specification for the custom spotlight entity that is part of Panopoly Widgets
Code
function panopoly_widgets_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
// If there are no files specified at all, use the default.
// TODO - make sure this works
foreach ($entities as $id => $entity) {
if (empty($items[$id]) && $field['settings']['default_image']) {
if ($file = file_load($field['settings']['default_image'])) {
$items[$id][0] = (array) $file + array(
'is_default' => TRUE,
'alt' => '',
'title' => '',
);
}
}
}
}