3

I am using the gallery formatter module to format photo galleries.

To satisfy a requirement I need to create a Display Suite code field that displays the list of pictures attached to a related node (attached through the Entity reference module).

The get the field_gallery containing images of the related page I use the following in the code field:

<?php 
    $relatedNode = node_load($entity->field_related_page['und']['0']['target_id']);
    $field = field_view_field('node', $relatedNode, 'field_gallery', array( 'label'=>'hidden'));
    echo drupal_render($field) ;
?>

However this only displays a raw list of images. I need this list of images to be fomatted by the gallery formatter.

The formatter should be passed to field_view_field() as an array (instead of array( 'label'=>'hidden')) but how can I get the list of key->values that fill the array?

0

May I suggest field slideshow if you havent tried that already. Field Slideshow

Provides a Slideshow formatter for Image fields, using JQuery Cycle plugin.

Compared to Views slideshows, building the slideshow from multiple nodes, this module builds it from a single node, with a multi-valued Image/Media/Field Collection field.

0

You can try code below:

<?php 
    $display = array(
      'label' => 'hidden',
      'type' => 'galleryformatter_default'
    );
    $relatedNode = node_load($entity->field_related_page['und']['0']['target_id']);
    $field = field_view_field('node', $relatedNode, 'field_gallery', $display);
    print drupal_render($field);
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.