Skip to content

2.2.2

Choose a tag to compare

@jtsternberg jtsternberg released this 27 Jun 17:04
· 1171 commits to develop since this release

Enhancements

  • You can now set admin post-listing columns with an extra field parameter, 'column' => true,. If you want to dictate what position the column is, use 'column' => array( 'position' => 2 ),. If you want to dictate the column title (instead of using the field 'name' value), use 'column' => array( 'name' => 'My Column' ),. If you need to specify the column display callback, set the 'display_cb' parameter to a callback function. Columns work for post (all post-types), comment, user, and term object types.
  • Updated Datepicker styles using JJJ's "jQuery UI Datepicker CSS for WordPress", so props Props @stuttter, @johnjamesjacoby. Also cleaned up the timepicker styles (specifically the buttons) to more closely align with the datepicker and WordPress styles.
  • CMB2 is now a lot more intelligent about where it is located in your installation. This update should solve almost all of the reasons to use the 'cmb2_meta_box_url' filter (thought it will continue to work as expected). (#27, #118, #432, related wiki item)
  • Implement CMB2_Ajax as a singleton. Props jrfnl (#602).
  • Add classes and classes_cb CMB2 box params which allows you to add additional classes to the cmb-wrap. The classes parameter can take a string or array, and the classes_cb takes a callback which returns a string or array. The callback will receive $cmb as an argument. These classes are also passed through a new filter, 'cmb2_wrap_classes', which receives the array of classes as the first argument, and the CMB2 object as the second. Reported/requested in #364.
  • Make the 'title' field type accept extra arguments. Props @vladolaru, @pixelgrade (#656).
  • Updated cmb2_get_oembed() function to NOT return the "remove" link, as it's intended for outputting the oembed only. This is a backwards-compatibility concern. If you were depending on the "remove" link, use cmb2_ajax()->get_oembed( $args ) instead.
  • New function, cmb2_do_oembed()', which is hooked to 'cmb2_do_oembed', so you can use do_action( 'cmb2_do_oembed', $args ) in your themes without function_exists() checks.
  • New method, CMB2:set_prop( $property, $value ), for setting a CMB2 metabox object property.
  • The CMB2_Field object instances will now have a cmb_id property and a get_cmb method to enable access to the field's CMB2 parent object's instance, in places like field callbacks and filters (e.g. $cmb = $field->get_cmb();).
  • Add a data-fieldtype attribute to the field rows for simpler identification in Javascript.
  • Moved each type in CMB2_Types to it's own class so that each field type can handle it's own field display, and added the infrastructure to maintainn back-compatibility.
  • New CMB2_Utils methods, notempty() and filter_empty(), both of which consider null, '' and false as empty, but allow 0 (for saving 0 as a field value).
  • New CMB2_Utils public methods, get_url_from_dir(), get_file_ext(), get_file_name_from_path(), and wp_at_least().
  • Add a cmb_pre_init Javascript event to allow overriding CMB2 defaults via JS.

Bug Fixes

  • Fix issue with 'default' callback not being applied in all instances. Introduced new CMB2_Field::get_default() method, and 'default_cb' field parameter. Using the 'default' field parameter with a callback will be deprecated in the next few releases. (#572).
  • Be sure to call CMB2_Field::row_classes() for group field rows. Also, update CSS to use the "cmb-type-group" classname instead of "cmb-repeat-group-wrap".
  • Introduce new 'text' and 'text_cb' field parameters for overriding CMB2 text strings instead of using the 'options' array. (#630)
  • Fix bug where the value of '0' could not be saved in group fields.
  • Fix bug where a serialized empty array value in the database for a repeatable field would output as "Array".
  • Allow for optional/empty money field. Props @jrfnl (#577).
  • The CMB2::$updated parameter (which contains field ids for all fields updated during a save) now also correctly adds group field ids to the array.