I’d check out some of the things over at https://github.com/CMB2/CMB2/wiki/Tips-&-Tricks specifically around appending custom content that you could use to potentially append extra button markup. I know I’ve seen javascript used to add new stuff as well for some things I’ve been a part of utilizing CMB2.
Thanks. That got me started, but this seems to work. I tried adding a custom field type, but ran into a snag easily modifying the extra padding in the surrounding field divs. So I just made a function that blasts a named action button onto the page. If there’s a more elegant approach, I’m all ears.
// Adds custom action button to form
// $name is the the text displayed in the button
// $id is the unique id of the action button
function cmb2_add_action_button($section_options, $name, $id) {
$section_options->add_field(array(
'name' => esc_attr($name),
'id' => esc_attr($id),
'render_row_cb' => 'cmb2_row_callback_for_action_button',
));
}
function cmb2_row_callback_for_action_button( $field_args, $field ) {
$button_name = $field->args["name"];
$button_id = $field->args["id"];
?>
<div class="action-button-row">
<p class="submit"><input type="submit" name="<?php echo esc_attr($button_id); ?>"
id="<?php echo esc_attr($button_id); ?>"
class="button button-primary"
value="<?php echo esc_attr($button_name); ?>"></p>
</div>
<?php
}
Nothing I know of off the top of my head, but I welcome anyone else who may have ideas for this that are better than what I’ve suggested.