Linux 软件免费装
Banner图

CMB2

开发者 jtsternberg
webdevstudios
tw2113
更新时间 2023年2月17日 05:26
捐献地址: 去捐款
PHP版本: 5.2 及以上
WordPress版本: 5.9
版权: GPLv2 or later
版权网址: 版权信息

标签

forms fields options settings metaboxes

下载

详情介绍:

CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind. Easily manage meta for posts, terms, users, comments, or create custom option pages. CMB2 is a complete rewrite of Custom Metaboxes and Fields for WordPress. To get started, please follow the examples in the included example-functions.php file and have a look at the basic usage instructions. You can see a list of available field types here. Contribution Development occurs on Github, and all contributions welcome. Please read the CONTRIBUTING doc for more details. A complete list of all our awesome contributors found here: github.com/CMB2/CMB2/graphs/contributors Features: Translation If you are looking to provide language translation files, Please do so via WordPress Plugin Translations. Documentation 3rd Party Resources Custom Field Types
  1. The pw_select field acts much like the default select field. However, it adds typeahead-style search allowing you to quickly make a selection from a large list
  2. The pw_multiselect field allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder
Other Helpful Resources Links Known Issues

安装:

If installing the plugin from wordpress.org:
  1. Upload the entire /CMB2 directory to the /wp-content/plugins/ directory.
  2. Activate CMB2 through the 'Plugins' menu in WordPress.
  3. Copy (and rename if desired) example-functions.php into to your theme or plugin's directory.
  4. Edit to only include the fields you need and rename the functions.
  5. Profit.
If including the library in your plugin or theme:
  1. Place the CMB directory inside of your theme or plugin.
  2. Copy (and rename if desired) example-functions.php into a folder above the CMB directory OR copy the entirety of its contents to your theme's functions.php file.
  3. Edit to only include the fields you need and rename the functions (CMB directory should be left unedited in order to easily update the library).
  4. Profit.

升级注意事项:

2.10.1 Bug Fixes
  • Fix issue with date picker formatting. Fixes #1448.
2.10.0 Enhancements
  • Sanitize URLs, defaulting to https. Props @paulschreiber (#1413).
  • Establish Cypress E2E Testing. Props @markjaquith (#1437).
  • Updated the JS shiftRows functionality to be simpler, and fix issues with JS initialization. Fixes #1426 and #1431.
  • Updated various NPM dependencies for security issues.
Bug Fixes
  • Update to prevent deprecation notice:Required parameter $i follows optional parameter $args.... Props @carloswph (#1417).
  • Make each date field more resilient to various date/timestamp values passed in (from REST API).
2.9.0 Enhancements
  • Added cmb2_tab_group_tabs filter for adding arbitrary menu page urls to the cmb2 tabs, and move tab markup output to separate method, CMB2_Options_Hookup::options_page_tab_nav_output(). Fixes #1407.
  • Limit use of italic, including removing from field descriptions. Fixes #1404.
  • Add to list of valid image types from get_allowed_mime_types(), which makes SVGs more reliable when using the Safe SVG plugin. Fixes #1223.
Bug Fixes
  • Fixes PHP warnings on repeatable ColorPicker with an array as default. Props @rubengc (#1340).
  • Address PHP 7.4, compatibility issues with func_get_args(). Fixes #1389.
  • Better generated array key for cached fields, fixes issue where wrong field is found. Fixes #14053.
  • Fix issue with options-pages being changed to register on a hook priority of 5 instead of the default 10, causing some back-compatibility issues. Fixes #1410.
2.8.0 Enhancements Bug Fixes
  • Ensure enqueue wp-color-picker is enqueued for color fields. Props @rubengc (#1339).
  • Fix empty name/id attributes on 'file_list' buttons. Props @pgroot91 (#1347).
  • Fix wysiwyg field type not working in a group, by ensuring scripts properly enqueued. Props @yoren (#1361).
  • Fix $object_id doc block types in helper-functions.php. Fixes #1365.
  • Fix Metabox toggles visually broken with WP 5.5.x. Fixes #1382.
  • Fix PHP Deprecated: Required parameter $field_id follows optional parameter $type, due to changes in PHP 8.0. Fixes #1396.
  • Fix PHP notice caused by deprecated_param method in PHP 7.4. Props @jonathanstegall (#1400).
2.7.0 Enhancements
  • Added support for sortable columns by default, with ability to disable with 'column' => array( 'disable_sortable' => true ). Props @RubenMartins (#1281).
  • New field type, 'taxonomy_select_hierarchical'. Fixes #751
  • New text, textarea and wysiwyg character counter options. For now, this feature is not available to wysiwyg field types within repeatable groups. Props @gyrus (#1276).
  • The new parameters:
  • 'char_counter' - Defaults to false, no counter. Set to true, or words to count words instead of characters.
  • 'char_max' - integer. When defined, counter shows remaining characters/words.
  • 'char_max_enforce' - boolean, default: false. Currently only applied (as maxlength attribute) to text and textarea fields which use 'characters' for counter.
  • You can also override the default text strings associated with these parameters:
  • 'words_left_text' - Default: "Words left"
  • 'words_text' - Default: "Words"
  • 'characters_left_text' - Default: "Characters left"
  • 'characters_text' - Default: "Characters"
  • 'characters_truncated_text' - Default: "Your text may be truncated."
  • Update styling to be more compatible with WordPress 5.3. Props @galengidman (#1314)
  • Add a new box parameter, register_rest_field_cb, which when used allows overriding the way CMB2 handles the register_rest_field callbacks, and defining your own REST prefix for your fields. See this PR comment for more context.
  • Cleanup by renaming CMB2_hookup to CMB2_Hookup. Classes are case-insensitive, so this is a backwards-compatible change. Props @szepeviktor (#1330, #1328).
  • Validate composer.json for Travis CI. Props @szepeviktor (#1326).
  • Added LICENSE file to meet GitHub Community standards. Props @RubenMartins (#1316).
  • Add new "cmb2_display_class_{$fieldtype}" filter and 'display_class' field parameter to allow specifying the class to use to display the field (in admin columns, etc).
  • Update CMB2_Types::_id() to allow not appending the iterator attribute if a repeatable field.
  • Added CMB2_Utils::concat_attrs() test for nested arrays as data attributes.
  • Various updates per VIP feedback. Props @kevinlangleyjr, @mikeselander (#1255, #1257, #1259, #1261 #1262, and various direct commits. See #1260).
Bug Fixes
  • Fix some issues with Travis. Props @anhskohbo (#1220).
  • Javascript: Correctly pass the newly created row to the cmb2_add_row triggered event.
  • Various code-formatting and code documentation improvements. Props @tw2113.
  • Don't exclude composer.json from the distribution. Props @johnbillion (#1225).
  • Ignore some more directories in the distribution package. Props @johnbillion (#1226).
  • Use CMB2_Field::get_rest_value() to get values for fields in the post REST API endpoints (#1284).
  • Fix issue where oEmbed fields' live-preview would not work if the field was added within a group, along with some other similarly related issues. Fixes #1157.
  • Fix issue when using REST API for file and text_datetime_timestamp_timezone field types, the supporting field data was not provided (e.g. the file id for file field, and the utc value for the text_datetime_timestamp_timezone field). Fixes https://wordpress.org/support/topic/cmb2-rest-api-image-file-field-as-an-object/.
  • Escaping Improvements to File Base and File Fields. Props @tomjn (#1296, #1297).
  • Fix issue where repeatable CodeMirror textareas could not be clicked/draggged to highlight text. Props @JPry (#1300).
  • taxonomy_select_hierarchical now saves to the correct location, the term relationships table. Props @latheva (#1307).
  • Fix issue (#1158) where default REST API endpoints (e.g. /wp/v2/{post_type}) would show all boxes for all custom post types even though not registered to the post-type. Props @Mte90 (#1238).
  • Update and cull npm dependencis. Fixes #1308.
  • Fix some jshint issues.
  • Updated the WordPress embeds URL references.
  • Updates to account for WordPress 5.2 oEmbed changes.
  • Fix to ensure date picker fields can have a default value. Fixes #1245.
  • Added function_exists( 'add_action' ) check to bootstrap file to ensure compatibility with composer usage. Props @salcode (#1271, #1270)
  • Corrected link to facetwp-cmb2 in README.md. Props @marcelreschke (#1248).
  • Use get_user_locale() in admin area instead of get_locale(). Fixes #1267.
  • CMB2::is_box_type() now also checks for taxonomies if box is registered to "term" object type. This should fix some issues where CMB2 term meta was not showing up in REST API requests to the term endpoints.

更新日志:

2.10.1 Bug Fixes 2.10.0 Enhancements Bug Fixes 2.9.0 Enhancements Bug Fixes 2.8.0 Enhancements Bug Fixes 2.7.0 Enhancements Bug Fixes 2.6.0 Bug Fixes Enhancements 2.5.1 Bug Fixes 2.5.0 Enhancements Bug Fixes 2.4.2 Bug Fixes 2.4.1 Bug Fixes 2.4.0 Enhancements php '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 ). Bug Fixes 2.3.0 Enhancements Bug Fixes 2.2.6.2 Bug Fixes 2.2.6.1 Enhancements Bug Fixes 2.2.6 Enhancements Bug Fixes 2.2.5.3 Enhancements Bug Fixes 2.2.5.2 Bug Fixes 2.2.5.1 Bug Fixes 2.2.5 - 2017-08-07 Enhancements Bug Fixes 2.2.4 - 2017-02-27 Enhancements 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: php $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,. Props @norcross (#836). * 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. * Example functions clean up. Props @PavelK27 (#866). * New CMB2_Utils methods, get_available_image_sizes() and get_named_size(). Props @Cai333. Bug Fixes 2.2.3.1 - 2016-11-08 Enhancements Bug Fixes 2.2.3 - 2016-10-25 Enhancements php ... 'show_on_cb' => function( $cmb ) { return has_tag( 'cats', $cmb->object_id ); }, ... Bug Fixes 2.2.2.1 - 2016-06-27 Bug Fixes 2.2.2 - 2016-06-27 Enhancements Bug Fixes 2.2.1 Bug Fixes 2.2.0 - 2016-02-27 Enhancements Bug Fixes 2.1.2 - 2015-10-01 Bug Fixes 2.1.1 - 2015-09-30 Enhancements Bug Fixes 2.1.0 - 2015-08-05 Bug Fixes 2.0.9 - 2015-07-28 Bug Fixes Enhancements 2.0.8 - 2015-06-01 Bug Fixes 2.0.7 - 2015-05-28 Enhancements Bug Fixes 2.0.6 - 2015-04-30 Enhancements Bug Fixes 2.0.5 - 2015-03-17 Bug Fixes 2.0.4 - 2015-03-16 Enhancements Bug Fixes 2.0.3 - 2015-03-15 Enhancements Bug Fixes 2.0.2 - 2015-02-15 Enhancements 2.0.1 - 2015-02-02 2.0.1 is the official version after beta, and includes all the changes from 2.0.0 (beta). 2.0.0(beta) - 2014-08-16 2.0.0 is the official version number for the transition to CMB2, and 2.0.1 is the official version after beta. It is a complete rewrite. Improvements and fixes are listed below. Note: This release requires WordPress 3.8+ Enhancements Bug Fixes 1.3.0 - (never released, merged into CMB2) Enhancements Bug Fixes 1.2.0 - 2014-05-03 Enhancements Bug Fixes 1.1.3 - 2014-04-07 Bug Fixes 1.1.2 - 2014-04-05 Bug Fixes 1.1.1 - 2014-04-03 Bug Fixes 1.1.0 - 2014-04-02 Enhancements Bug Fixes 1.0.2 - 2014-03-03 Enhancements Bug Fixes 1.0.1 - 2014-01-24 Enhancements Bug Fixes 1.0.0 - 2013-11-30 0.9.4 0.9.3 0.9.2 0.9.1 0.9 0.8 - 2012-01-19 0.7 0.6.1 0.6 0.5 0.4