wp-papi / papi

:rocket: WordPress Page Type API with custom fields
https://wp-papi.github.io
MIT License
263 stars 32 forks source link

Dropdown property - Allow null value #249

Closed nlemoine closed 6 years ago

nlemoine commented 6 years ago

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?

frozzare commented 6 years ago

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.

nlemoine commented 6 years ago

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 ?

frozzare commented 6 years ago

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