Support

Account

Home Forums Add-ons Repeater Field Passing values inside array

Solving

Passing values inside array

  • Hi

    I need pass value inside array with repeater field, see the example:

    `$choices = array(
    ‘– Make a Selection –‘ => ”,
    ‘Choice 1’ => ‘Choice 1’,
    ‘Choice 2’ => ‘Choice 2’,
    ‘Choice 3’ => ‘Choice 3’,
    ‘Choice 4’ => ‘Choice 4’,
    ‘Choice 5’ => ‘Choice 5’
    );
    return $choices;`

    And my code

    `if(have_rows(‘lista_de_variables’)) : while(have_rows(‘lista_de_variables’)) : the_row();

    $choice = get_sub_field(‘dimension’);

    endwhile; endif;

    // this function returns an array of
    // label => value pairs to be used in
    // a the select field
    $choices = array(
    ‘– Make a Selection –‘ => ”,
    $choice => $choice,
    );
    return $choices;`

    How do it?

  • HI @carlosromanxyz

    Thanks for getting in touch!

    Your issue is not very clear, would you mind sharing more details on what you are after?

  • James:

    I’ve a ACF Repeater, this repeater generates a rows with data called “Dimensions”, for example:

    * Dimension one
    * Dimension two
    * Dimension three

    After i’ve a array with this data (label => value)

    * Choice one => Choice one
    * Choice two => Choice two
    * Choice three => Choice three

    This array populates a dropdown element in form, i need follow this structure because plugin dev recommend, so i need pass rows to array

    Please see the example: https://wordpress.org/plugins/contact-form-7-dynamic-select-extension/

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Passing values inside array’ is closed to new replies.