Custom content type with a gallery and its "subgalleries" (or categorized gallery) in D7 I have a content type with some custom fields, and I would like to have a gallery in it, with the images grouped into predefined "categories" - like a "subgallery".

For example, I have a "building" content type, and I would like to categorize the photos of it depending on of which part of the building (house) these photos were made or if they are simply archive photos, etc.: you can think of categories e.g. like "Inside", "Outside", "Archive", "Misc."

I made a drawing to make it clearer:



What would be the best way to solve this problem?

Thanks for any kind of ideas!
Ask if anything is unclear.



In the meantime, I found a Media Gallery issue related to the topic:
New feature: Gallery containers (other related issues: Hierarchical galleries, Categorizing galleries)
I don't know how well exactly this will fit in with your use case, but this is how I'd do it:


Create a content type called "SubGallery", add an Image field to it with unlimited cardinality.
Create the content type you want to contain the sub-galleries ("Building")
Add an Entity reference field to the "Building" type that references an unlimited number of "SubGallery" nodes.
Choose "Inline Entity Form" as the widget for that field, which will allow users to create the "SubGallery" content types within the same form as the "Building".


You can make use of the standard node title field for the name of the sub-gallery, or you might add a vocabulary called "Gallery Type", and add a field referencing that to the "SubGallery" content type. Then when your users add a new sub-gallery via the inline edit form, they can choose one of your pre-defined gallery types to associate with it.

If you do add the vocabulary and no longer need a node title for the sub-galleries,you could use Automatic Nodetitles to fill it in automatically and hide it from the users.