wp-papi/papi

Dropdown property - Allow null value

nlemoine opened this issue · 3 comments

Steps to reproduce

Add a dropdown property like:

papi_property( [
  'title'    => 'Dropdown',
  'slug'     => 'my_dropdown_slug',
  'type'     => 'dropdown',
  'settings' => [
    'select2' => false,
    'placeholder' => 'Select a value',
    'items' => [
      'White' => '#ffffff',
      'Black' => '#000000'
    ]
  ]
] )

What I expected

The ability to save an empty value. Like https://github.com/wp-papi/papi/blob/v3.2.0/src/properties/class-papi-property-dropdown.php#L108-L113 is suggesting you can do.

What happened instead

The first rendered option tag is:

<option>Select a value</option>

Where it should be:

<option value="">Select a value</option>

What versions of softwares are you using?

  • Papi: 3.2.0
  • WordPress: 4.9.2

Hi,

Thanks for your issue, this project isn’t mantinated anymore as you can read in the read me. Pull request will be accepted when I or any new people have the time.

Sorry, I didn't check the master branch. Seems like you already tackled this issue: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-dropdown.php#L106-L108

Any plans to release a patched version? 3.2.1 ?

No, sorry. Since this project isn't maintained anymore no new releases will be made. You can always run against dev-master