That works well for given fields. Is there any way to hook into the option page title itself? I tried a bunch of the before_ and after_ options with no luck on the new_cmb2_box call.
Thanks!
hmm
I believe you could potentially handle that with your own custom display callback, but that’s a fair amount of potential work.
I’m also seeing these hooks that are before the output of the forms, but not sure exactly where in the context it’d show to say the options page title:
/**
* Hook before form table begins
*
* @param array $cmb_id The current box ID.
* @param int $object_id The ID of the current object.
* @param string $object_type The type of object you are working with.
* Usually <code>post</code> (this applies to all post-types).
* Could also be <code>comment</code>, <code>user</code> or <code>options-page</code>.
* @param array $cmb This CMB2 object.
*/
do_action( 'cmb2_before_form', $this->cmb_id, $object_id, $object_type, $this );
/**
* Hook before form table begins
*
* The first dynamic portion of the hook name, $object_type, is the type of object
* you are working with. Usually <code>post</code> (this applies to all post-types).
* Could also be <code>comment</code>, <code>user</code> or <code>options-page</code>.
*
* The second dynamic portion of the hook name, $this->cmb_id, is the meta_box id.
*
* @param array $cmb_id The current box ID
* @param int $object_id The ID of the current object
* @param array $cmb This CMB2 object
*/
do_action( "cmb2_before_{$object_type}_form_{$this->cmb_id}", $object_id, $this );
Worth trying.