You are here

function photoswipe_field_formatter_view in PhotoSwipe 7

Same name and namespace in other branches
  1. 7.2 photoswipe.module \photoswipe_field_formatter_view()

Implements hook_field_formatter_view().

File

./photoswipe.module, line 178
Photswipe integration with Drupal module.

Code

function photoswipe_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  if (!empty($items)) {
    $element = array(
      '#type' => 'container',
      '#attributes' => array(
        'class' => array(
          'photoswipe-gallery',
        ),
      ),
    );
  }
  foreach ($items as $delta => $item) {
    $element[$delta] = array(
      '#theme' => 'photoswipe_image_formatter',
      '#item' => $item,
      '#node' => $entity,
      '#field' => $field,
      '#display_settings' => $display['settings'],
    );
  }
  return $element;
}