5.7 - How to make a block accept multiple images, desc.etc (custom image gallery)

Permalink
So I am developing a block for my website that is a gallery. I have successfully built it to a functional state for adding 1 image, name and description per block, but I would like to have multiple images, names, desc condensed into one instance of the block.

I have tried looking for information on how to do this and I have also attempted to find a solution within Concrete5's Slider block (each slide has its own fields, you then add another slide with its own fields.etc like I need) but with no joy as it is hard to navigate without knowing what exactly I am looking at.

It's obvious I need some pretty fancy code to solve this but I don't know where to look for an answer.
----------------------------------------------------------------------------------------------------------

Solution found. Duplicate Image Slider Core block and amend view.php as follows. Annotated to make life easier for anyone who is new to block building/php.

<?php defined('C5_EXECUTE') or die("Access Denied.");
$navigationTypeText = ($navigationType == 0) ? 'arrows' : 'pages';
$c = Page::getCurrentPage();
if ($c->isEditMode()) { ?>
/*---Doesn't render the gallery in edit---*/
    <div class="ccm-edit-mode-disabled-item" style="<?php echo isset($width) ? "width: $width;" : '' ?><?php echo isset($height) ? "height: $height;" : '' ?>">
        <div style="padding: 40px 0px 40px 0px;"><?php echo t('Gallery disabled in edit mode.')?></div>
    </div>
<?php  } else { ?>
<div class="blah">/*---your outer container goes here if needed---*/
        <?php if(count($rows) > 0) { ?>
            <?php foreach($rows as $row) { ?>
                <?php
                $f = File::getByID($row['fID'])
                ?>

 
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
You might want to consider using a file set for the gallery. I have a couple image galleries in the marketplace, and use file sets to get the images. This way, it would be much easier to manage what's in the gallery.
Joshwa replied on at Permalink Reply
Yeah I have thought about that but this way will likely be a problem in this case as I have custom fields needing to be filled with content on a per image basis (name, description, type of file (image, gif or link to another page), set (for filtering)).

As it currently stands I have everything working together fluidly for the page render, but the essential .js that handles the image resizing for the thumbnails conflicts with edit mode making editing of individual blocks difficult. It's also giving me OCD seeing 30 blocks when I know there is a way of condensing all this into one!

Very frustrating not being able to find any documentation on this :(
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
It is possible to still use a fileset, as you could set up some custom attributes that could be applied to each file within the set. Then it could be used within the gallery.

If interested, I could be hired to create a custom block for you.
Joshwa replied on at Permalink Reply
Thanks, but while it would be nice to get a quick solution I'm interested in learning the process more than getting it working. Thank you for the offer though
tallacman replied on at Permalink Best Answer Reply
tallacman
the core slideshow block accepts individual images. why not start with that, strip out the css and js as needed and go from there?
Joshwa replied on at Permalink Reply
Yep, I tried to adapt the core slideshow and a few free slideshow blocks to see if I could understand how they were functioning, but ran across some issues getting them to run after editing. The controller.php file alone is 200 lines!

That said, your avatar has got the look of "Is that it? go on, give it another go..." so I will reluctantly give another shot from the ground up... I'd best get the coffee on :P
Joshwa replied on at Permalink Reply
After persistence and many back and forths I'm well on the way to getting it functional and interacting with my .js correctly. Trial and error and still more to solve but the ground work is done. Thanks for the nudge