Releases: CMB2/CMB2
Releases · CMB2/CMB2
v2.2.3.1
Enhancements
- Better styling for disabled group "X" buttons, and add title attr. Fixes #773.
Bug Fixes
- Use quotes for
label[for=""]
selector. FixedSyntax error, unrecognized expression
. Props @anhskohbo (#789). - Fix
ReferenceError: tinyMCE is not defined
javascript errors (happening when trying to remove a repeatable field/group). Fixes #790, and #730. - Fix REST API
'show_in_rest'
examples inexample-functions.php
. Any REST API boxes/fields must use the'cmb2_init'
hook (as opposed to the'cmb2_admin_init'
hook).
v2.2.3
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()
andCMB2_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).
v2.2.2.1
Bug Fixes
- Fix issue that kept CMB2 stylesheet from being enqueued when using the options-page snippets.
- Fix issue which caused the CMB2 column display styles to be enqueued in the wrong pages. Now only enqueues on admin pages with columns.
2.2.2
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
andclasses_cb
CMB2 box params which allows you to add additional classes to the cmb-wrap. Theclasses
parameter can take a string or array, and theclasses_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, usecmb2_ajax()->get_oembed( $args )
instead. - New function,
cmb2_do_oembed()
', which is hooked to'cmb2_do_oembed'
, so you can usedo_action( 'cmb2_do_oembed', $args )
in your themes withoutfunction_exists()
checks. - New method,
CMB2:set_prop( $property, $value )
, for setting a CMB2 metabox object property. - The
CMB2_Field
object instances will now have acmb_id
property and aget_cmb
method to enable access to the field'sCMB2
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()
andfilter_empty()
, both of which considernull
,''
andfalse
as empty, but allow0
(for saving0
as a field value). - New
CMB2_Utils
public methods,get_url_from_dir()
,get_file_ext()
,get_file_name_from_path()
, andwp_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.
v2.2.1
v2.2.0
Enhancements
- Term Meta! As of WordPress 4.4, WordPress will have the ability to use term metadata. CMB2 will work with term meta out of the box. To do so, see the example cmb registration in the
yourprefix_register_taxonomy_metabox
function in example-functions.php. - New hooks which hook in after save field action:
'cmb2_save_field'
and"cmb2_save_field_{$field_id}"
. Props wpsmith (#475). - The "cmb2_sanitize_{$field_type}" hook now runs for every field type (not just custom types) so you can override the sanitization for all field types via a filter.
CMB2::show_form()
is now composed of 3 smaller methods,CMB2::render_form_open()
,CMB2::render_field()
,CMB2::render_form_close()
(#506).- RTL Style generated. Props @devinsays (#510).
- Properly scope date/time-pickers styling by adding a class to only cmb2 picker instances. (#527)
- Allow per-field overrides for the date/time/color picker options (wiki documentation: Modify Field Date, Time, or Color Picker options)
Bug Fixes
- Fixed issue with
'taxonomy_select'
field type where a term which evaluated falsey would not be displayed properly. Props adamcapriola (#477). - Fix issue with colorpickers not changing when sorting groups.
'show_option_none'
field parameter now works on taxonomy fields when explicitly setting to false.- Fix so the date/time-picker javascript respects the
'date_format'
and'time_format'
field parameters. Props @yivi (#39, #282, #300, #318, #330, #446, #498). - Fix a sometimes-broken unit test. Props JPry (#539).
- Fix issue with oembed fields not working correctly on options pages. (#542).
- Fix issue with repeatable field elements stealing focus from "submit" button.
v2.1.2
v2.1.1
Enhancements
- Make all CMB2::save_fields arguments optional to fall-back to
$_POST
data. Props JPry. - New filter,
cmb2_non_repeatable_fields
for adding additional fields to the blacklist of repeatable field-types. Props JPry (#430). - New recommended hoook for adding metaboxes,
cmb2_admin_init
. Most metabox registration only needs to happen if in wp-admin, so there is no reason to register them when loading the front-end (and increase the memory usage).cmb2_init
still exists to register metaboxes that will be used on the front-end or used on both the front and back-end. Instances ofcmb2_init
in example-functions.php have been switched tocmb2_admin_init
. - Add
'render_row_cb'
field parameter for overriding the field render method. - Add
'label_cb'
field parameter for overriding the field label render method. - Allow
CMB2_Types::checkbox()
method to be more flexible for extending by taking an args array and an$is_checked
second argument. - More thorough unit tests. Props pglewis, (#447,#448).
- Update
CMB2_Utils::image_id_from_url
to be more reliable. Props wpscholar, (#453). cmb2_get_option
now takes a default fallback value as a third parameter.
Bug Fixes
- Address issue where
'file'
and'file_list'
field results were getting mixed. Props augustuswm (#382, #250, #296). - Fix long-standing issues with radio and multicheck fields in repeatable groups losing their values when new rows are added. (#341, #304, #263, #246, #150)
- Fixes issue where currently logged-in user's profile data would display in the "Add New User" screen fields. (#427)
- Fixes issue where radio values/selections would not always properly transfer when shifting rows (up/down). Props jamiechong (#429, #152).
- Fixes issue where repeatable groups display "Array" as the field values if group is left completely empty. (#332,#390).
- Fixes issue with
'file_list'
fields not saving properly when in repeatable groups display. Props jamiechong (#433,#187). - Update
'taxonomy_radio_inline'
and'taxonomy_multicheck_inline'
fields sanitization method to use the same method as the non-inline versions. Props superfreund (#454).
v2.1.0
v2.0.9
Enhancements
- Updated/Added many translations. Props fxbenard, (#203) and Mte90 for the Italian translation.
- Updated
'file_list'
field type to have a more intutive selection in the media library, and updated the 'Use file' text in the button. Props SteveHoneyNZ (#357, #358). 'closed'
group field option parameter introduced in order to set the groups as collapsed by default. Requested in #391.- Added
"cmb2_{$object_type}_process_fields_{$cmb_id}"
hook for hooking in and modifying the metabox or fields before the fields are processed/sanitized for saving. - Added Comment Metabox support. Props GregLancaster71 (#238, #244).
- New
"cmb2_{$field_id}_is_valid_img_ext"
filter for determining if a field value has a valid image file-type extension.
Bug Fixes
'multicheck_inline'
,'taxonomy_radio_inline'
, and'taxonomy_multicheck_inline'
field types were not outputting anything since it's value was not being returned. Props ediamin, (#367, (#405).'hidden'
type fields were not honoring the'show_on_cb'
callback. Props JPry, (commits).- Fixed: There was no minified cmb2-front.min.css file.
- Fallback for fatal error with invalid timezone. Props ryanduff (#385).
- Fix issues with deleting a row from repeatable group. Props yuks (#387).
- Ensure value passed to
strtotime
inmake_valid_time_stamp
is cast to a string. Props vajrasar (#389). - Fixed issue with Windows IIS and bundling CMB2 in the theme. Props DevinWalker, (#400, #401)