CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind.
Enable linking options pages via tabbed-navigation. Will output tabbed navigation for options-pages which share the same 'tab_group'
CMB2 box property. This snippet demonstrates how to create a top-level menu options page with multiple submenu pages, each with the tabbed navigation. To specify a different tab title than the options-page title, set the 'tab_title'
CMB2 box property. See #301, #627.
Complete the zh-CN
translation. Props @uicestone (#1089).
Update the nl_NL
translation. Props @tammohaannl (#1101).
Better display for white over transparent images (e.g. logos) by using a checkered background for images. (#1103)
Ability to disable the options autoload parameter via filter ("cmb2_should_autoload_{$options_key}"
) or via a box parameter for 'options-page'
box registrations ('autoload' => false,
). (#1093)
'textarea_code'
field type now uses CodeMirror that is used by WordPress (#1096). A field can opt-out to return to the previous behavior by specifying an 'options'
parameter:
'options' => array( 'disable_codemirror' => true )
As with the other javascript-enabled fields, the code-editor defaults can be overridden via a data-codeeditor
attribute. E.g:
attributes' => array(
'data-codeeditor' => json_encode( array(
'codemirror' => array(
'mode' => 'css',
),
) ),
,
Improve/add comment info banners at top of CMB2 CSS files.
Added resetBoxes
/resetBox
Javascript methods for resetting CMB2 box forms.
Improved styles for fields in the new-term form.
New CMB2_Boxes
methods for filtering instances of CMB2
, CMB2_Boxes::get_by( $property, $optional_compare )
and CMB2_Boxes::filter_by( $property, $to_ignore = null )
.
'taxonomy_*'
fields when used for term fields/meta. Save the value to term-meta.jw-cmb2-rgba-picker-js
script (and enqueue our wp-color-picker-alpha
) if it is actually found.'alpha'
option to the field options array. Thank you to JayWood for his work on his custom field type.'before_group'
parameter.'render_row_cb'
param for group fields. Fixes #1041.CMB2::get_field()
).CMB2_Base::unset_param_callback_cache()
).'message_cb'
box property, which allows defining a custom callback for adding options-save messages on options-page
boxes. An example has been added to example-functions.php.'file'
field type ID is removed from the database if the 'file'
field type's value is empty (Support thread).user_can_richedit()
is false ("Disable the visual editor when writing" user option is checked, or various unsupported browsers). See #1031.F j, Y
) would not properly translate into jQuery UI date formats. Support thread
'select_all_button' => false
was not working for 'taxonomy_multicheck'
field type (#1005)."cmb2_init_hookup_{$cmb_id}"
hook. Allows plugins to unhook/rehook/etc.CMB2_Utils::normalize_if_numeric()
to address problems when using floats as select/radio values. Fixes #869. See #1013.CMB2_Options_Hookup::$option_key
property.options-general.php
), and if the errors are not disabled via the 'disable_settings_errors'
box property.See 2.2.5.2 for an additional bug-fix release.
See 2.2.5.1 and 2.2.5.2 for bug-fix releases.
'taxonomy_radio_hierarchical'
, and 'taxonomy_multicheck_hierarchical'
, for displaying taxonomy options in a hierarchial layout. Props to eriktelepovsky for the working code. (#640)cmb2_group_wrap_attributes
filter.'query_args'
, which can be used by the 'taxonomy_*'
fields. Provides ability to override the arguments passed to get_terms()
.cmb2_can_save
filter now passes the CMB2 object as the 2nd parameter. Props @Arno33 (#994).CMB2_Types::file()
method.CMB2_Field:options()
method apart to allow re-setting options from field params. Related: reaktivstudios/cmb2-flexible-content/pull/8.CMB2:box_types()
method for getting the array of registered 'object_types'
for a box. Ensures the return is an array.CMB2::show_form()
CMB2::render_form_open()
CMB2::render_form_close()
CMB2::render_group_row()
CMB2::render_hidden_fields()
CMB2::save_fields()
CMB2::process_fields()
CMB2::process_field()
CMB2::pre_process()
CMB2::after_save()
CMB2::add_fields()
file
/file_list
fields to properly show a preview for SVG images. Fixes #874..button-secondary
class instead of the .button
class. This alleviates some front-end issues for themes which target the .button
class. This is a backwards-compatibility break. If your theme or plugin targets the .button
class within CMB2, you will need to update to use .button-secondary
.CMB2_Option
methods are called when the option value is empty, as well as additional unit tests for the CMB2_Option
class. Props @anhskohbo (#993).|
or /
from breaking file fields. Props @lipemat (#1003).jQuery.fn.attr('value', val) no longer sets properties
warning.Modify 'taxonomy_*'
fields to return stored terms for non-post objects.
Modify CMB2::get_sanitized_values()
to return the sanitized 'taxonomy_*'
field values. Also added "cmb2_return_taxonomy_values_{$cmb_id}"
filter to modify if 'taxonomy_*'
field values are returned. Fixes #538.
Allow outputting CMB2 boxes/fields in additional locations in the post-editor.
The new locations are: form_top
, before_permalink
, after_title
, and after_editor
These would be defined by setting the context
property for your box:
$cmb_demo = new_cmb2_box( array(
...
'context' => 'before_permalink',
) );
If it is preferred that the fields are output without the metabox, then omit the 'title'
property from the metabox registration array, and instead add 'remove_box_wrap' => true,
.
New field parameter, 'render_class'
, allowing you to override the default 'CMB2_Type_Base'
class that is used when rendering the field. This provides interesting object-oriented ways to override default CMB2 behavior by subclassing the default class and overriding methods. The render class can also be overridden with the "cmb2_render_class_{$fieldtype}"
filter, which is passed the default render class name as well as the CMB2_Types
object, but this should be used sparingly, and within the context of your project's boxes/fields or you could break other plugins'/themes' CMB2 fields.
Improvements to the file
/file_list
fields javascript APIs, including using undersore templates.
Small improvements to the styling for the file_list
field type.
New action hook, cmb2_footer_enqueue
, which occurs after CMB2 enqueues its assets.
New CMB2_Utils
methods, get_available_image_sizes()
and get_named_size()
. Props @Cai333.
'quicktags'
param is set to false. Props @timburden (#797, #796).file_list
item could occasionally remove the field row. (#828).file
/file_list
field preview images work with named sizes. Props @Cai333 (#848, #844).CMB2_Utils::get_file_ext()
.title
field type has no name value, then only output a span element (instead of a header element).