### Closure for 'show_on_cb' parameter Source: https://github.com/wpsight/wpcasa/blob/master/vendor/cmb2/cmb2/CHANGELOG.md Example of using a closure for the 'show_on_cb' parameter in a CMB2 box or field configuration. The closure receives the CMB2 object and returns a boolean based on whether the current object has the 'cats' tag. ```php ... 'show_on_cb' => function( $cmb ) { return has_tag( 'cats', $cmb->object_id ); }, ... ``` -------------------------------- ### Override code editor defaults with data-codeeditor attribute Source: https://github.com/wpsight/wpcasa/blob/master/vendor/cmb2/cmb2/CHANGELOG.md Use this PHP snippet to customize the CodeMirror settings for a textarea_code field by specifying a data-codeeditor attribute. The example sets the mode to 'css'. This attribute overrides the default code editor settings. ```php 'attributes' => array( 'data-codeeditor' => json_encode( array( 'codemirror' => array( 'mode' => 'css', ), ) ), ), ``` -------------------------------- ### Set CMB2 box context to before_permalink Source: https://github.com/wpsight/wpcasa/blob/master/vendor/cmb2/cmb2/CHANGELOG.md Defines a CMB2 box with the 'before_permalink' context to output fields in that location in the post-editor. The '...' represents omitted registration arguments. ```php $cmb_demo = new_cmb2_box( array( ... 'context' => 'before_permalink', ) ); ``` -------------------------------- ### Disable CodeMirror for textarea_code field Source: https://github.com/wpsight/wpcasa/blob/master/vendor/cmb2/cmb2/readme.txt Specify an 'options' array with 'disable_codemirror' set to true in the field config to opt out of the WordPress CodeMirror editor introduced in CMB2 2.4.0. ```php 'options' => array( 'disable_codemirror' => true ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.