5.7 - How to make a block accept multiple images, desc.etc (custom image gallery)
PermalinkI 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']) ?>

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 :(
If interested, I could be hired to create a custom block for you.
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