bobbingwide / oik-fields

Field formatting for custom post type (CPT) meta data, plus [bw_field], [bw_fields], [bw_new] and [bw_related] shortcodes
https://www.oik-plugins.com/oik-plugins/oik-fields-custom-post-type-field-apis/
1 stars 0 forks source link

Support for WordPress 5.0 and the new editor #30

Open bobbingwide opened 6 years ago

bobbingwide commented 6 years ago

Since early 2017 a new Block editor has been under development. Code named Gutenberg this new editor is being developed as a feature plugin. It is expected to be merged into core for WordPress 5.0.

Over time, more content will be created using the Block editor than the Classic editor. The new solution needs to be backward compatible with our existing solution, so there shouldn’t be a need to change anything and it should still work. But that has not yet proven to be the case. Also, over time, more content will be created/edited using the Block editor than the Classic editor. We need to embrace the improvements.

So, rather than being compatible with Gutenberg we need to be Gutenberg aware.

For oik-fields there are two areas.

  1. Fields which rely on JavaScript to be displayed in meta boxes
  2. Fields which will need to be accessible in the Block editor through the REST API.
Area Problem Reference
show_in_rest oik-fields does not support show_in_rest
Google map virtual field requires Google Maps JavaScript
Show_in_rest Not all data can be exposed using the REST API Security

Non functional requirements

bobbingwide commented 6 years ago

There's a third area. Fields which already produce unexpected messages when the content is displayed as part of the [bw_field] or [bw_fields] shortcode.

bobbingwide commented 6 years ago

There's a third area. Fields which already produce unexpected messages when the content is displayed as part of the [bw_field] or [bw_fields] shortcode.

Problems detected are email field without a value produces

Warning: strlen() expects parameter 1 to be string, array given in C:\apache\htdocs\wordpress\wp-includes\formatting.php on line 2502

Notice: Array to string conversion in C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-email.php on line 92

Media field produces Fatal error: Uncaught Error: Call to undefined function bw_thumbnail() in C:\apache\htdocs\wordpress\wp-content\plugins\oik-media\includes\oik-media.inc:62

bobbingwide commented 5 years ago

WordPress 5.0 was released on 6th December 2018. The latest version of oik-fields does co-exist peacefully with WordPress 5.0 and Gutenberg 4.8. There are some instances where updates to post meta fields, performed server side, are not reflected in the Block editor display. You need to reload the editor to see the changes.

bobbingwide commented 5 years ago

As part of the fix for https://github.com/bobbingwide/oik/issues/120 I prototyped a change to the bw_metadata() function that supports the [bw_fields] shortcode. It calls oik_is_shortcode_expansion_necessary() to determine if oik thinks it's worth expanding shortcodes.

It's not caused any problems that I'm aware of so I'm happy to commit it... with oik-fields dependent upon oik v3.3.0