Drupal 7 Album Folders for Field Gallery
Primary tabs
Drupal 7 - creating multiple album folders for... by kiwipion
Introduction
Up to now we have been using a single page to contain all our galleries, which is soon going to fill up for those of us who take plenty of snaps. So in this tutorial we will be offering the option of creating a content type called Field Gallery Album to house selected galleries and provide a page to fit thumbnails for each album.
Method
We will be creating Views Displays for the albums and associating the Views Displays with View Modes from the contents manage display settings.
Skills Aquisition
- Cloning Views
- Views Contextual Filters
- Views Relationships
- View Modes
Prerequisites
You will need to have completed the field gallery tutorial. The node gallery tutorial will also help for it does cover View Modes and View Displays.
Steps
We will make a new content type called Field Gallery Albums, it makes things simpler because the Album content type consists of both the output from the Node & Field Galleries.
- Create the new content type "Field Gallery Album"
- Go into the Field Gallery content's Manage Fields settings, edit the node reference url and add the content type Field Gallery Album that can be referenced.
- Now's a good time to create some 'Field Gallery Albums' and some 'Field Galleries' for those Albums so we can test our Views and View mode configurations.
- Go into views, and make a clone of the Field Gallery View, I'm going to call mine 'Field Gallery Albums'
- Delete or disable the 'field gallery' display.
- Go into the Album view, change the Entity Content Settings bundles to the Field Gallery Album type
- Change the pager settings to display the specific number of items as 1.
- Add a new Page Display, I'll call mine 'Field Gallery Albums' Page and set the path to Albums.
- Change the Format to Grid and settings to the numbers of columns you want and the Show: to Content | Teaser
- And in the Filter section change the Content Type to Field Gallery Album.
- Go to the Album Display, we need to create a Contextual Filter to ensure only the correct galleries are displayed in the Field Gallery Albums. Add a Contextual Filter and select the Node Reference URL from the Field Gallery content type and enter the settings for the Validator as such

- Go to the Album Display in the Field Gallery view and make sure that the Field Gallery Album Bundle is added to the Entity Content Settings.
- Create a new menu item in the main menu, I'm calling mine "Field Gallery Album" and enter the path from your page view, which in my case was "albums'.
Now if you go to your newly created menu you should see both your views displays such as this

We are seeing both view display outputs because currently the manage display settings for the "Field Gallery Album" content type 'Manage Display' settings are set to display both.
- Go into the 'Manage Display' settings and make the Field Gallery views's display hidden.
Now we should only see the single thumbnail, but it is currently linking directly to the Field Gallery view of the Albums containing the Field Galleries, we need to redirect the link to the Field Gallery and we can remove the title of the Field Gallery.
- Go back into the view that generates the single image and add a relationship using the Field Galleries node reference.
- Add a Content: Nid field, use the relationship that we just created and select 'exclude from display'. This is going to be used to hold the address of the Node Gallery Album which is where we want to relink to. Here are my setting for the Nid field.

- Rearrange the fields so Content: Nid is above the image field.
- The title field can now be removed or excluded from the display.
- Open the image field. Remove the link in the Formatter section. Select 'REWRITE RESULTS' and then 'Output this field as link'. Scroll down and get the Content: Nid token and insert it into the 'Link Path'. Note we will prefix the text "node/" in front of the token. Below is an example of the settings for this field.

For the Field Gallery Albums we will need to ensure that the View Mode generated from the Field Gallery View is made visible. I'll add the "Full Content" View mode to set this. Now currently only the Field Gallery Albums view is available.
- Now when viewing the Field Gallery Albums we are seeing every Field Gallery instead of the Field Galleries that belong in this Album.
- Add a Contextual Filter in the Album Display of the Field Gallery View that will only display the Field Galleries connected by the node reference url in the Field Gallery content type as such

- Check that the Arguments: id is enabled in the 'Entity Content Settings'
Wrap-up
As well as giving you the benefit of creating any number of Albums to house your galleries, you will also have been given good exposure to some of views more advanced techniques in the form of Contextual Filters and Relationships as well as utilizing View Modes.
Latest Updates
Recent comments
Recent Tweets
- New post: Posting location co-ordinates to a drupal service - Part 2 http://t.co/MQhlVKBNKC — 1 month 5 days ago
- New post: Posting location co-ordinates to a drupal service - Part 1 http://t.co/2xlYgqFaJ0 — 1 month 5 days ago
- New post: Connecting a drupal service with a mobile application - Part 2 http://t.co/01cFtAunDs — 1 month 5 days ago
- New post: Using drupal services to connect to mobile applications - Part 1 http://t.co/VEURftHCef — 1 month 5 days ago
- New post: Creating Drupal 7 video gallery http://t.co/HvpKU7uT — 3 months 1 week ago









Comments
album-folders-node-gallery
thank you for all your well explained tutorials; I've tried without succes to replicate this tutorial to create an "album-folders-node-gallery"; when you have some time, please remake this tutorial also for node gallery; thank you so much for your sharing
Thanks, and integrate node gallery into field gallery folders?
Hello, thank you for your excellent tutorials. I have been following along with making a field gallery, a node gallery, and field gallery folder. I tried to attach my node galleries to the field gallery album content type (in the album teaser view from the node gallery tutorial) but I can't get the galleries to sort by the NID of the field gallery folder. This is after I created new node galleries through an instance of the field gallery folder content type. Can the node galleries be linked to the field gallery folders? I'm looking for a way to group node galleries into folders. Should I just use a taxonomy term reference? Thank you.
Hints to hopefully point you in the right direction
Hi, I have not yet prototyped this, but try adding a node reference url widget to your node gallery and point it to the field gallery album. In your gallery album view add a contextual filter for your node reference which should give you a link to your node galleries in your field album. To get the thumbnails for your node galleries you will probaby need to add a relationship in your view.
I'll add this to my tutorials todo list.
Thank you
Thank you for the fast response. I look forward to seeing your tutorial!
Pages
Add new comment