I have a content type with two fields: Exterior Images and Interior Images

Both of these fields are Unlimited Values - so the user can upload as many images as they want to exterior and interior. Screenshots: http://prntscr.com/a9m8o5 http://prntscr.com/a9m8uc

Now I'm trying to create a view that grabs all exterior and interior images uploaded and displays them.

The only way I can find to have each image displayed as its own individual field and row is to perform a UNION betwen something like SELECT exterior UNION SELECT interior etc. etc. but I just can't seem to figure out the rest.

I've tried creating two views and combining them like this:

function pgallery_views_pre_execute(view &$view){

    if ($view->name == 'photo_gallery'&& $view->current_display == 'page_1') {
        // View 1 contains Interior Images
        $view1 = views_get_view('photo_gallery');
        $query1 = $view1->build_info['query'];

        // View 2 contains Exterior Images
        $view2 = views_get_view('photo_gallery');
        $query2 = $view2->build_info['query'];


        $view->build_info['query'] = $query1;



but it won't render whatever is in $query2 - it just repeats $query1 values. So I get the correct number of "rows" from the result but it repeats the data for some reason. Please help!


Views Field View module does that. Create a new view and add both needed views as fields.

This module allows you to embed a view as a field in a view. A new field handler is made available, so this can also be used in area (header/footer/empty) handlers as well as rows.

This view handler can accept arguments from fields of the parent view using tokens and pass them into the child view for each row. Raw or rendered token values can be used, as well as static values.


You should be able to add both fields in views and in the settings for the field, there are options for multiple values. So views go through each node and outputs each image.

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.