Skip to content

v2.2.3

Choose a tag to compare

@jtsternberg jtsternberg released this 25 Oct 20:52
· 618 commits to trunk since this release

Enhancements

  • CMB2 REST API! CMB2 now has WP REST API endpoints for displaying your boxes and fields data, as well as registers rest fields in the existing post, user, term, and comment endpoints (in the cmb2 namespace). Enabling the REST API for your boxes/fields is opt-in, meaning it will not be automatically enabled. For more info, check out the wiki.
  • Small string improvement, move a period inside the translatable string. Props @pedro-mendonca (#672).
  • Introduce the 'save_field' boolean field parameter for disabling the saving of a field. Useful if you want to display the value of another field, or use a disabled/read-only field. Props @jamesgol (#674, #346, #500).
  • Update docblocks for CMB2_Field::save_field_from_data() and CMB2_Field::save_field(). Props @jamesgol (#675).
  • More javascript events tied to the media modal actions (related to the 'file' and 'file_list' fields). 'cmb_media_modal_init', 'cmb_media_modal_open', and 'cmb_media_modal_select'.
  • All CMB2 JS events now also get the CMB2 JS object passed in the list of arguments.
  • CMB2 JS object is now instantiated without stomping existing object, to enable extending.
  • New field parameter for taxonomy fields, 'remove_default' which allows disabling the default taxonomy metabox. Props @c3mdigital (#593).
  • Change 'row_classes' to just 'classes', to mirror the metabox 'classes' property. Also now accepts a 'classes_cb' parameter for specifying a callback which returns a string or array. The callback will receive $field_args as the first argument, and the CMB2_Field $field object as the second argument. ('row_classes' will continue to work, but is deprecated)
  • Make wysiwyg editors work in the repeatable groups context. A standard repeatable (non-group) wysiwyg field is not supported (but will possibly be included in a future update). Props @johnsonpaul1014 (#26, #99, #260, #264, #356, #431, #462, #657, #693).
  • Add an id to the heading tag in the title field. This allows linking to a particular title using the id.
  • Internationalization improvements. Props ramiy (#696).
  • Ensure that saving does not happen during a switch-to-blog session, as data would be saved to the wrong object. See more.
  • Add 'cmb2_group_wrap_attributes' filter to modifying the group wrap div's attributes. Filter gets passed an array of attributes and expects the return to be an array. Props jrfnl (#582).
  • Update the unit-tests README and inline docs. Props bobbingwide (#714, #715).
  • Minor update to make naming-conventions consistent. Props ramiy (#718).
  • Update files to be compatible with PHP7 CodeSniffer standards. Props ryanshoover (#719, #720).
  • Make exception message translatable. Props ramiy (#724).
  • Portuguese translation provided by @alvarogois and @pedro-mendonca - #709, #727.
  • Stop using $wp_version global Props ramiy (#731).
  • Closures (anonymous functions) are now supported for any box/field '*_cb' parameters. E.g.
    ...
    'show_on_cb' => function( $cmb ) { return has_tag( 'cats', $cmb->object_id ); },
    ...

Bug Fixes

  • If custom field types use a method and the Type object has not been instantiated, Try to guess the Type object and instantiate.
  • Normalize WordPress root path (ABSPATH) and theme rooth path (get_theme_root()). Props @rianbotha (#677, #676).
  • Fix issue with 'cmb2_remove_row' Javascript callback for non-group row removal. Fixes #729).
  • Fix issue with missing assignment of variable (undefined variable). Props @anhskohbo (#779).