super-cpt icon indicating copy to clipboard operation
super-cpt copied to clipboard

Add Repeatable Meta Fields

Open kferran opened this issue 11 years ago • 15 comments

Would love the ability to have a repeatable meta box

kferran avatar Jul 08 '13 17:07 kferran

+1

tnguyen14 avatar Aug 03 '13 18:08 tnguyen14

+2

vjandrei avatar Sep 02 '13 09:09 vjandrei

+3

owldesign avatar Sep 30 '13 23:09 owldesign

+4

JensRavens avatar Nov 14 '13 18:11 JensRavens

So here's a thought I have about how this could be implemented:

Introducing a new type repeater, which can be declared like so:

$meta->add_meta_box( array(
    'id' => 'staff_details',
    'fields' => array(
        'name' => array( 'type' => 'text' ),
        'repeat' => array( 
            'type' => 'repeater' ,
            'subfields' => array(
                'profile_image' => array(
                    'type' => 'media'
                )
            )
        )
    )
)

The repeater field will have a subfields argument that can take in an array of fields just like the current implementation.

The problem with this is the many level of nested array could be confusing and prone to errors. It is also worth thinking about whether we should only allow 1 level of subfields.

tnguyen14 avatar Nov 18 '13 18:11 tnguyen14

thanks, it is really helpful

N-Molham avatar Nov 18 '13 19:11 N-Molham

I'll be needing something like this shortly. I can try and put something together over the next two weeks. I like @tnguyen14 's thoughts. Are there more opinions on how to implement this?

sixlive avatar Nov 24 '13 19:11 sixlive

Maybe like this for individual repeating field(s)

$tests->add_meta_box( array(
    'id' => 'test-box',
    'context' => 'normal',
    'fields' => array(
        'test-field-one' => array('type'=>'text', 'repeat' => true)
    )
) );

And like this for repeatable box(es)

$tests->add_meta_box( array(
    'id' => 'test-box',
    'context' => 'normal',
    'fields' => array(
        'test-field-one' => array('type'=>'text')
    ),
    'repeat' => true
) );

sixlive avatar Nov 24 '13 20:11 sixlive

+5

mattie02 avatar Jan 17 '14 00:01 mattie02

Is this feature still on the horizon?

tnguyen14 avatar Mar 27 '14 01:03 tnguyen14

I do have to ask if this feature will be added anytime soon, that would be the bomb. Please let us know, thank you.

g-kanoufi avatar Oct 16 '14 09:10 g-kanoufi

I have a working prototype that I've used in several production sites. It only handles single level repeating groups and the ui needs to be refined. I'm going to get in touch with @mboynes.

sixlive avatar Oct 16 '14 10:10 sixlive

@sixlive Care to share?

hilja avatar Dec 12 '14 12:12 hilja

Is this project still active? Last update to it was back in July.

tnguyen14 avatar Jan 09 '15 18:01 tnguyen14

+1 It seems that when a project starts supporting loop/repeater/nested fields it is abandoned. 😿

strarsis avatar May 24 '17 14:05 strarsis