Skip to content

Dropdown property doesn't work with numeric keys #225

Closed

Description

@rasmusbe

What I expected

The saved values in admin

What happened instead

Invalid values in admin

Steps to reproduce

papi_property(
	[
		'title'    => __( 'File list', 'bbws-admin' ),
		'type'     => 'dropdown',
		'slug'     => 'list',
		'settings' => [
			'items' => [
				'Hello' => 1,
				'World' => 2
			]
		]
	]
)

Select World and save. Saved value is 2. Displayed value in admin is Hello.

What versions of softwares are you using?

  • Papi: latest
  • WordPress: latest

Activity

  1. sasimon commented on Mar 31, 2017

    @sasimon

    At some point during the admin page load process the value retrieved needs to be explicitly cast as a string. I'm just not sure where.

  2. added this to the v3.2.0 milestone on Apr 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions