Title: Callback Function on CMB2
Last modified: September 19, 2016

---

# Callback Function on CMB2

 *  Resolved [johnquimera](https://wordpress.org/support/users/johnquimera/)
 * (@johnquimera)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/callback-function-on-cmb2/)
 * Hello, I am Brazilian and not dominate the English, I apologize for the bad writing.
   I have a function with arrays that use the Redux Framework, see below.
 *     ```
       	function my_get_sidebar_layouts( $inherit = false) {
   
       		$layouts = array();
   
       		if ( $inherit ) {
       			$layouts['inherit'] = array( 'title' => __( 'Inherit', THEME_SLUG ), 'img' => IMG_URI . '/images/inherit.png' );
       		}
   
       		$layouts['none'] = array( 'title' => __( 'No sidebar (full width)', THEME_SLUG ), 'img' => IMG_URI . '/images/none.png', 'images_path'      => get_template_directory_uri(),);
       		$layouts['left'] = array( 'title' => __( 'Left sidebar', THEME_SLUG ), 'img' => IMG_URI . '/images/left.png' );
       		$layouts['right'] = array( 'title' => __( 'Right sidebar', THEME_SLUG ), 'img' => IMG_URI . '/images/right.png' );
   
       		return $layouts;
       	}
       ```
   
 * I use this way in redux:
 *     ```
                   array(
                       'id'        => 'archive_sidebar',
                       'type'      => 'image_select',
                       'title'     => __( 'Sidebar layout', THEME_SLUG ),
                       'subtitle'  => __( 'Choose sidebar layout for archive templates', THEME_SLUG ),
                       'options'   => ny_get_sidebar_layouts(),
                       'default'   => 'right'
                   ),
       ```
   
 * it works perfect…
    A few days ago I’m trying to use it the same way in CMB2 with
   CMB2-radio-image-master. But I can not. Only the value goes, but the image and
   the title does not. can anybody help me?
 * How do I use this function in CMB2 fields in the same way that I use in Redux?
 *     ```
           $cmb_demo->add_field( array(
               'name'             => __( 'Test Radio Image', 'cmb2' ),
               'desc'             => __( 'field description (optional)', 'cmb2' ),
               'id'               => $prefix . 'radioimg',
               'type'             => 'radio_image',
               'options'          => array(
                   'full-width'    => __('Full Width', 'cmb2'),
                   'sidebar-left'  => __('Left Sidebar', 'cmb2'),
                   'sidebar-right' => __('Right Sidebar', 'cmb2'),
               ),
               'images_path'      => get_template_directory_uri(),
               'images'           => array(
                   'full-width'    => 'images/content_no_sid.png',
                   'sidebar-left'  => 'images/content_sid_left.png',
                   'sidebar-right' => 'images/content_sid_right.png',
               )
           ) );
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [9 years, 8 months ago](https://wordpress.org/support/topic/callback-function-on-cmb2/#post-8199207)
 * Answered on the GitHub issue you opened.
 * For anyone stumbling across this, it’s at [https://github.com/WebDevStudios/CMB2/issues/743](https://github.com/WebDevStudios/CMB2/issues/743)

Viewing 1 replies (of 1 total)

The topic ‘Callback Function on CMB2’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/callback-function-on-cmb2/#post-8199207)
 * Status: resolved