0

We have a field collection containing an image and three different Text fields. How can we open the whole field collection (= all four fields (= image + texts)) within the colorbox??? The module colorbox-node does not help because we don't have separate nodes (and no URL-pathes to the content).

3 Answers 3

1

You can have a look at the Entity popup module, it allows you to define a separate view mode for the popup content and includes an example on how to integrate with colorbox.

0

Create a field_collection view and in fields add your field as well as add the Colorbox overlay field. Configure Colorbox overlay to display the fields you want.

3
  • Thx. I'm inserting the images within the node. Could you please explain how I connect the field collection view with the current node (where my images are from)?
    – scar
    Commented Jul 8, 2013 at 16:05
  • You can create a Views block and use "Display suite"(drupal.org/project/ds) embedded that block in to node as a display formatter.
    – heshanlk
    Commented Jul 8, 2013 at 16:24
  • That worked fine, thank you again. But now I'm having trouble to get my Text fields within the colorbox overlay. I added a "colorbox trigger" which is set to the image. And within "popup" I added my fields: [field_image] [field_text1] etc. But the text is not shown????
    – scar
    Commented Jul 9, 2013 at 11:11
0

I followed this approach:

1) Create a Content Type and added a field as type 'Field collection' (Considering this field collection is not available in your instance. If you want to reuse an existing field collection that also you can go for)

2) Considering you have created a new field collection, now you need to add fields to the field collection by visiting 'admin/structure/field-collections' path

3) Now create a block (I am using custom block) with hook_block_info() & hook_block_view().

4) In hook_block_view() call a function in $block ['content'] & try to code similar way as below :


  $options = array(
    'attributes' => array(
      'class' => 'colorbox-node' 
    ), 
    'query' => array(
      'nid' => $nid, 
      'width' => 600 
    ) 
  );

  $html  = '';
  $html .= l( 'Add FC', 'field-collection/field-collection-name/add/node/' . $nid, $options );
  print $html;

  // Here, field collection name is 'field_collection_name' and we need to replace '_' with '-'

  // Here, $nid is the NODE ID, you want your field collection be associated with

5) Considering you have colorbox related modules (colorbox, colorbox_node) are enabled in your instance

Hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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