Please advice me on the following case:
In a content type I have an image field with the ability to upload many photos.
I would like only one (for example, the first) photo to be displayed on the page, and the rest to be viewed in a gallery after clicking the photo on the page / post.
The Field Multiple Limit module limits the number of photos displayed on the page, but also in the gallery, but I want all photos to be visible in the gallery and only one in the post / page. For the gallery I use Colorbox and Photoswipe.
Thanks in advance for any idea!
@amilenkov - I haven't tested this, but I would start by using the field formatter to limit the display to one image on field display for the node, but then add a block with a contextual filter and a view for the gallery. In the view, you will be able to change the number of images (I think).
@stpaultim, thanks for the idea. I also haven't tested this because it seems to me very complicated for editor users of my sites without special knowledge of blocks, layouts, etc. If it was for me, I would put the photo with manual HTML code in the Body field and then achieve what I want through HTML and CSS.
I came up with the ideas for several workaround solutions without a special module for this purpose. First it occurred to me to use CSS absolute positioning of the field and place the photos on top of each other - so only one of them will be visible. But then I came up with an even better idea and it works perfectly - css first child selector.
I share the code because I guess it can be useful for other users, and for other similar cases:
However, it would be good to have such a module that does this without the need for CSS customization - for people who do not know how to do this, one of the purposes of Backdrop CMS is to serve such users, right?
Such a module can achieve something else in an easy-to-use way - when there is more than one photo, the module can display a hint of how many photos can be viewed in the gallery, even though only one photo is shown in the main text.
At the moment this can be achieved with a second field for the number of photos and Field Group but the number of photos must be entered manually.
such a module existed under drupal 7 it was "media-gallery"
> I also haven't tested this because it seems to me very complicated for editor users of my sites without special knowledge of blocks, layouts, etc.
Again, I haven't tested this recently so I could be mistaken. But, if configured properly by the site builder or developer this should not be difficult for the editor to administer. The site editor would just add a bunch of images to a field.
The display page for this content type would automatically show the first image on it's own and be styled in the theme. Also, the developer/builder would position a block for a slideshow, which would also be styled as part of the theme.
The site editor who is adding the content would not need to know anything about views, blocks or CSS. This would all be configured in advance.
I'm not sure this is the BEST solution, but it is the one that came to mind. This solution would work best if you used field blocks to build the display page for the content type (short video: https://youtu.be/ApW9FJcxICQ).