function npop_field_formatter_view in Node pop-up 7
Implements hook_field_formatter_view().
File
- ./
npop.module, line 351 - Create popup nodes with ajax and Drupal core functionality.
Code
function npop_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
foreach ($items as $delta => $item) {
if ($entity_type == 'node') {
$uri = array(
'path' => 'node/' . $entity->nid,
'options' => array(
'attributes' => array(
'data-npop' => $entity->nid,
),
),
);
if (!drupal_is_front_page() && npop_check_change_url($entity->type)) {
$uri['options']['query']['parent'] = '/' . request_path();
}
}
else {
$uri = entity_uri($entity_type, $entity);
}
$element[$delta] = array(
'#theme' => 'image_formatter',
'#item' => $item,
'#image_style' => $display['settings']['image_style'],
'#path' => isset($uri) ? $uri : '',
);
}
return $element;
}