These options worked, thanks. But I'm still having troubles with the templating. I don't know much PHP, so I'm having trouble to understand how this parameter would work. Taking your code as example:
add_filter( 'rwmb_meta_boxes', 'your_prefix_select_demo' );
function your_prefix_select_demo( $meta_boxes ) {
$meta_boxes[] = array(
'title' => __( 'Select Field Demo', 'your-prefix' ),
'fields' => array(
array(
'name' => __( 'Select Advanced', 'your-prefix' ),
'id' => 'select_advanced',
'type' => 'select_advanced',
'options' => array(
'value1' => __( 'Label1', 'your-prefix' ),
'value2' => __( 'Label2', 'your-prefix' ),
),
'js_options' => [
'placeholder' => 'Select whatever you want',
'allowClear' => false,
'templateSelection' => formatState,
],
),
),
);
return $meta_boxes;
}
Being the formatState originally a JS function how am I supposed to use it? Should I pass the function call as a String and have it on a .js file or should I convert it to a PHP function? If I convert it to PHP function, how would I be able to get the 'state' object that is passed on the select2 example?
Sorry for the trouble. thanks.