Repeatable field groups in blocks

Permalink
Hi,

Working on my first concrete 5 site and built the base theme and few simple content blocks to use around the site. What i cant work out is how to make a block with a repeatable field group. Similar to how the cores image-slider block does it but with just 4 text fields, nothing complex.

Is there any examples or information out there? Cant find anythng in the docs and everything found on Google is outdated. The cores image slider block has no comments or code help and seems to be mainly javascript.

I would normally go about it using php and sql but the way concrete store data i cant seem to make it work. I guess this is because blocks can have many intstances and each row in the table is a version history of that instance.

All I'm trying to create is a block that allows the user to input 4 text fields and then if required another set of these four etc.

Is this even possible?

 
hutman replied on at Permalink Best Answer Reply 1 Attachment
hutman
Here is a sample. I've commented everything (I think) but feel free to ask any questions you might have.
eudemonics replied on at Permalink Reply
Brilliant, exactly what i was looking for and thanks for commenting the code so well.

It's shame the docs examples aren't as well built as this. Thanks again :)
eudemonics replied on at Permalink Reply
I've built a new block on basics taught in this block but cant get it to work with any of the helpers, how would you go about adding a pagelinks, images etc if required. The form arrays dont seem to work with these, or at least i dont understand how they would.

eg: in form_setup_html.php how would you include this in a repeating area?
<?php echo $form->label('fID', t('Background Image')); ?>
<?php echo $al->image('ccm-b-file', $view->field('fID'), t('Choose Image'), $f); ?>
hutman replied on at Permalink Reply
hutman
Unfortunately that is going to be significantly more difficult and not something that I can't explain here. I would suggest you look again at the core Image Slider block, the file manager stuff is in there.
eudemonics replied on at Permalink Reply
Worked it out by comparing with the core image slider block. Thanks once more Hutman :)
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
I have a FREE block that uses repeatable inputs:

https://www.concrete5.org/marketplace/addons/stylish-ordered-lists...