Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select field on Repeater not working (returning "Array" word) #1888

Closed
tnchuntic opened this issue May 12, 2018 · 1 comment
Closed

Select field on Repeater not working (returning "Array" word) #1888

tnchuntic opened this issue May 12, 2018 · 1 comment

Comments

@tnchuntic
Copy link

Issue description:

Select field on Repeater not working (returning "Array" word)

Version used:

WP Latest
Kirki Plugin Latest

Using theme_mods or options?

theme_mods

Code to reproduce the issue (config + field(s))

Kirki::add_section('dynamic_widgets_section', array(
'title' => esc_attr__('Dynamic Widgets', TEXTDOMAIN),
'description' => esc_attr__('Allows you to create widget sections.', TEXTDOMAIN),
'panel' => '',
'priority' => 160,
));

Kirki::add_field(THEME_CUSTOMISER_ID, array(
    'type' => 'repeater',
    'settings' => 'dynamic_widgets',
    'label' => esc_attr__('Dynamic Widgets', TEXTDOMAIN),
    'section' => 'dynamic_widgets_section',
    'priority' => 10,
    'row_label' => array(
        'type' => 'field',
        'value' => esc_attr__('Dynamic Widget', TEXTDOMAIN),
        'field' => 'widget_name',
    ),
    'button_label' => esc_attr__('Add Dynamic Widget', TEXTDOMAIN),
    'default' => array(
        array(
            'widget_name' => esc_attr__('Sidebar', TEXTDOMAIN),
            'widget_location' => esc_attr__('sidebar', TEXTDOMAIN),
        ),
        array(
            'widget_name' => esc_attr__('Footer', TEXTDOMAIN),
            'widget_location' => esc_attr__('footer', TEXTDOMAIN),
        ),
    ),
    'fields' => array(
        'widget_name' => array(
            'type' => 'text',
            'label' => esc_attr__('Widget Name', TEXTDOMAIN),
            'description' => esc_attr__('Dynamic Widget Name.', TEXTDOMAIN),
            'default' => '',
        ),
        'widget_location' => array(
            'type' => 'select',
            'label' => __('Widget Location', TEXTDOMAIN),
            'description' => esc_attr__('Dynamic Widget Location.', TEXTDOMAIN),
            'default' => 'option-sidebar',
            'priority' => 10,
            'multiple' => 0,
            'choices' => array(
                'option-header' => esc_attr__('Header', TEXTDOMAIN),
                'option-content' => esc_attr__('Content', TEXTDOMAIN),
                'option-sidebar' => esc_attr__('Sidebar', TEXTDOMAIN),
                'option-footer' => esc_attr__('Footer', TEXTDOMAIN),
            ),
        ),
    )
));
@asilcetin
Copy link
Contributor

asilcetin commented May 17, 2018

There are three different problems here:

  1. 'multiple' => 0, declaration is causing the "Array" output. Select field is by default non-multiple, so please remove this declaration.

  2. fixes #1892, fixes #1888 #1901 should fix the problem with registered value not showing up with non-multiple selects inside repeaters.

  3. Additionally you have "sidebar" and "footer" defined as defaults of widget_location however they are called "option-sidebar" and "option-footer" under choices.

aristath added a commit that referenced this issue May 17, 2018
aristath added a commit that referenced this issue Jun 20, 2018
* develop: (50 commits)
  possible fix for #1925
  Envato theme-check fixes
  Fix error when typography field has no font-family
  v3.0.33
  Folder permissions fix for google-fonts
  fixes #1892, fixes #1888
  3.0.32
  add choice per-control.
  use async as default for 3.0.31
  3.0.31
  3.0.30
  3.0.29
  add caches
  stable = 3.0.28 & use correct license in readme
  readme addition
  v3.0.28
  typo
  readme
  switch webfont loading to local when in the frontend
  add googlefonts @font-face to the footer
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants