function yourprefix_add_new_field_to_group()
{
    // Try to get a metabox w/ the id of '_yourprefix_group_metabox'
    if ($cmb_group_demo = cmb2_get_metabox('_yourprefix_group_metabox')) {
        $cmb_group_demo->add_field(array('name' => __('Test Text 2', 'your_textdomain'), 'desc' => __('field description (optional)', 'your_textdomain'), 'id' => 'text2', 'type' => 'text', 'attributes' => array('placeholder' => __("I'm some placeholder text", 'your_textdomain'))), '_yourprefix_group_demo', 2);
    }
}
Beispiel #2
0
function frontend_form_shortcode($atts = array())
{
    // current user
    $user_id = get_current_user_id();
    // user ID of metabox in front_end_metabox
    $metabox_id = '_frontend_form';
    // since post ID will not exist yet, just need to pass it
    $object_id = 'fake_object_id';
    // get cmb2 metabox object
    $cmb = cmb2_get_metabox($metabox_id, $object_id);
    // get $cmb object_type
    $post_types = $cmb->prop('object_types');
    $atts = shortcode_atts(array('post_author' => $user_id ? $user_id : 1, 'post_status' => 'pending', 'post_type' => reset($post_types)), $atts, 'cmb-frontend-form');
    foreach ($atts as $key => $value) {
        $cmb->add_hidden_field(array('field_args' => array('id' => "atts[{$key}]", 'type' => 'hidden', 'default' => $value)));
    }
    // Initiate our output variable
    $output = '';
    // Get any submission errors
    if (($error = $cmb->prop('submission_error')) && is_wp_error($error)) {
        // If there was an error with the submission, add it to our ouput.
        $output .= '<h3>' . sprintf(__('There was an error in the submission: %s', 'sexy'), '<strong>' . $error->get_error_message() . '</strong>') . '</h3>';
    }
    // If the post was submitted successfully, notify the user.
    if (isset($_GET['post_submitted']) && ($post = get_post(absint($_GET['post_submitted'])))) {
        // Get submitter's name
        $name = get_post_meta($post->ID, '_frontend_name', 1);
        $name = $name ? ' ' . $name : '';
        // Add notice of submission to our output
        $output .= '<h3>' . sprintf(__('Thank you%s, your new post has been submitted and is pending review by a site administrator.', 'sexy'), esc_html($name)) . '</h3>';
    }
    // Get our form
    $output .= cmb2_get_metabox_form($cmb, 'fake_object_id', array('save_button' => __('Submit Post', 'sexy')));
    return $output;
}
/**
 * This file demonstrates modifying existing registered CMB2 metabox fields
 */
function yourprefix_update_fields_properties()
{
    // Retrieve a CMB2 instance
    $cmb = cmb2_get_metabox('_yourprefix_demo_metabox');
    /**
     * Update a property on the '_yourprefix_demo_text' field.
     * In this case, we'll remove the show_on_cb conditional callback
     * (to instead always display the field)
     *
     * If field exists, and property updated, it will return the field id
     */
    $field_id = $cmb->update_field_property('_yourprefix_demo_text', 'show_on_cb', false);
    /**
     * Always need to compare this value strictly to false, as a field_id COULD be 0 or ''
     */
    if (false !== $field_id) {
        /**
         * Because we don't want to 'stomp' a field's 'attributes' property
         * (It may already have some attributes), we're going to get
         * the field's attributes property and append to it.
         */
        // Get all fields for this metabox
        $fields = $cmb->prop('fields');
        // Get the attributes array if it exists, or else create it
        $attributes = isset($fields['_yourprefix_demo_text']['attributes']) ? $fields['_yourprefix_demo_text']['attributes'] : array();
        // Add placeholder text
        $attributes['placeholder'] = __("I'm some placeholder text", 'your_textdomain');
        // Update the field's 'attributes' property
        $cmb->update_field_property('_yourprefix_demo_text', 'attributes', $attributes);
    }
}
Beispiel #4
0
 public function __construct($meta_box_config)
 {
     $this->setMetaBoxConfig($meta_box_config);
     $this->setCmb2Obj(\cmb2_get_metabox($this->getMetaBoxConfig()));
     //$cmb2Obj = $this->getCmb2Obj();
     //error_log('--- DEBUG: $cmb2Obj ---');
     //error_log(print_r($cmb2Obj, true));
     //add_action("admin_init", array($this, 'adminInit'), 15);
 }
/**
 * Gets the front-end-post-form cmb instance
 *
 * @return CMB2 object
 */
function wds_frontend_cmb2_get()
{
    // Use ID of metabox in wds_frontend_form_register
    $metabox_id = 'front-end-post-form';
    // Post/object ID is not applicable since we're using this form for submission
    $object_id = 'fake-oject-id';
    // Get CMB2 metabox object
    return cmb2_get_metabox($metabox_id, $object_id);
}
/**
 * Gets the offer-new cmb instance
 *
 * @return CMB2 object
 */
function tbws_testimonial_cmb2_get()
{
    // Use ID of metabox in wds_frontend_form_register
    $metabox_id = 'tbws_testimonial';
    // Post/object ID is not applicable since we're using this form for submission
    $object_id = 'tbws_testimonial_id';
    // Get CMB2 metabox object
    return cmb2_get_metabox($metabox_id, $object_id);
}
Beispiel #7
0
 /**
  * Add another field to the $metabox_id CMB box instance
  *
  * @since 0.1.0
  */
 function add_rest_api_override_field()
 {
     // Retrieve the CMB2 instance
     $cmb = cmb2_get_metabox($this->metabox_id);
     if (!$cmb) {
         return;
     }
     foreach ($this->fields() as $field) {
         $cmb->add_field($field);
     }
 }
 /**
  * Handles saving of the $_POST data
  * @since  0.1.3
  * @param  int $term_id Term's ID
  */
 public function do_save($term_id)
 {
     if (!class_exists('CMB2')) {
         return;
     }
     $object_id = $this->id($term_id);
     $cmb = cmb2_get_metabox($this->metabox, $object_id);
     if (isset($_POST[$cmb->nonce()]) && wp_verify_nonce($_POST[$cmb->nonce()], $cmb->nonce())) {
         $this->do_override_filters($term_id);
         $cmb->save_fields($object_id, 'options-page', $_POST);
     }
 }
 public function test_cmb2_get_metabox()
 {
     // Test that successful retrieval by box ID
     $retrieve = cmb2_get_metabox($this->cmb_id);
     $this->assertEquals($this->cmb, $retrieve);
     // Test that successful retrieval by box Array
     $cmb = cmb2_get_metabox($this->metabox_array);
     $this->assertEquals($this->cmb, $cmb);
     // Test successful creation of new MB
     $cmb1 = cmb2_get_metabox($this->metabox_array2);
     $cmb2 = new CMB2($this->metabox_array2);
     $this->assertEquals($cmb1, $cmb2);
 }
 /**
  * Initiate CMB2 Taxonomy Meta
  *
  * @since 1.0.0
  *
  * @param string  $taxonomy          Taxonomy Slug
  * @param mixed   $meta_box  Metabox config array or Metabox ID
  * @param string  $title             Optional section title
  * @param array   $option_callbacks  Override the option setting/getting
  */
 public function __construct($taxonomy, $metabox, $title = '', $option_callbacks = array())
 {
     $this->cmb = cmb2_get_metabox($metabox);
     // if passing a metabox ID, and that ID was not found
     if (!$this->cmb) {
         return;
     }
     // If a title was passed in
     if ($title) {
         // Then add a title field to the list of fields for CMB
         $this->cmb->add_field(array('name' => $title, 'id' => sanitize_title($title), 'type' => 'title'), 1);
     }
     parent::__construct($taxonomy, array(), '', $option_callbacks);
 }
Beispiel #11
0
 public function start_customizer($wp_customize)
 {
     $customizer_objects = array();
     $customizer_boxes = CMB2_Boxes::get_all();
     foreach ($customizer_boxes as $type => $instance) {
         $customizer_objects[] = cmb2_get_metabox($type, 0, 'customizer');
     }
     $field_type_mapping = array('title' => 'WP_Customize_Control', 'text' => 'WP_Customize_Control', 'text_small' => 'WP_Customize_Control', 'text_medium' => 'WP_Customize_Control', 'text_email' => 'WP_Customize_Control', 'text_url' => 'WP_Customize_Control', 'text_money' => 'WP_Customize_Control', 'colorpicker' => 'WP_Customize_Color_Control', 'file' => 'WP_Customize_Media_Control');
     foreach ($customizer_objects as $index => $cmb) {
         /* Add Address Info to Customizer */
         $customizer_id = $cmb->prop('id');
         $wp_customize->add_section($customizer_id, array('title' => $cmb->prop('title'), 'priority' => $cmb->prop('priority'), 'capability' => 'edit_theme_options'));
         $fields = $cmb->prop('fields');
         foreach ($fields as $field_type) {
             $type = $field_type['type'];
             $type_class = isset($field_type_mapping[$type]) ? $field_type_mapping[$type] : false;
             /* Street */
             $wp_customize->add_setting($field_type['id'], array('type' => 'option'));
             $wp_customize->add_control(new $type_class($wp_customize, $field_type['id'], array('label' => $field_type['name'], 'section' => $customizer_id, 'settings' => $field_type['id'], 'priority' => 10)));
         }
     }
 }
/**
 * Display checkbox metabox below title field
 * @link https://github.com/WordPress/WordPress/blob/56d6682461be82da1a3bafc454dad2c9da451a38/wp-admin/edit-form-advanced.php#L560-L567
 */
function yourprefix_output_custom_mb_location()
{
    cmb2_get_metabox('_yourprefix_display_title')->show_form();
}
Beispiel #13
0
/**
 * Display a metabox form & save it on submission
 * @since  1.0.0
 * @param  mixed   $meta_box  Metabox config array or Metabox ID
 * @param  int     $object_id Object ID
 * @param  array   $args      Optional arguments array
 */
function cmb2_print_metabox_form($meta_box, $object_id = 0, $args = array())
{
    $object_id = $object_id ? $object_id : get_the_ID();
    $cmb = cmb2_get_metabox($meta_box, $object_id);
    // if passing a metabox ID, and that ID was not found
    if (!$cmb) {
        return;
    }
    $args = wp_parse_args($args, array('form_format' => '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<input type="submit" name="submit-cmb" value="%4$s" class="button-primary"></form>', 'save_button' => __('Save', 'cmb2'), 'object_type' => $cmb->mb_object_type(), 'cmb_styles' => $cmb->prop('cmb_styles'), 'enqueue_js' => $cmb->prop('enqueue_js')));
    // Set object type explicitly (rather than trying to guess from context)
    $cmb->object_type($args['object_type']);
    // Save the metabox if it's been submitted
    // check permissions
    // @todo more hardening?
    if ($cmb->prop('save_fields') && isset($_POST['submit-cmb'], $_POST['object_id'], $_POST[$cmb->nonce()]) && wp_verify_nonce($_POST[$cmb->nonce()], $cmb->nonce()) && $object_id && $_POST['object_id'] == $object_id) {
        $cmb->save_fields($object_id, $cmb->object_type(), $_POST);
    }
    // Enqueue JS/CSS
    if ($args['cmb_styles']) {
        CMB2_hookup::enqueue_cmb_css();
    }
    if ($args['enqueue_js']) {
        CMB2_hookup::enqueue_cmb_js();
    }
    $form_format = apply_filters('cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb);
    $format_parts = explode('%3$s', $form_format);
    // Show cmb form
    printf($format_parts[0], $cmb->cmb_id, $object_id);
    $cmb->show_form();
    if (isset($format_parts[1]) && $format_parts[1]) {
        printf(str_ireplace('%4$s', '%1$s', $format_parts[1]), $args['save_button']);
    }
}
 /**
  * Save fields earlier in the load order (cmb2_after_init)
  *
  * @since  0.1.0
  *
  * @return null
  */
 public function save_fields()
 {
     // Retrieve the CMB2 instance
     $cmb = cmb2_get_metabox($this->metabox_id);
     // Save the metabox if it's been submitted
     // check permissions
     if ($cmb && isset($_POST['submit-cmb'], $_POST['object_id'], $_POST[$cmb->nonce()]) && wp_verify_nonce($_POST[$cmb->nonce()], $cmb->nonce()) && $_POST['object_id'] == $this->key) {
         $cmb->object_type('options-page');
         $cmb->save_fields($this->key, $cmb->object_type(), $_POST);
     }
 }
Beispiel #15
0
 public function test_multiple_meta_rows()
 {
     $prefix = 'testing';
     $post_id = $this->post_id;
     $array_val = array('check1', 'check2');
     $cmb_demo = cmb2_get_metabox(array('id' => $prefix . 'metabox', 'title' => __('Test Metabox', 'cmb2'), 'object_types' => array('page'), 'show_on_cb' => 'yourprefix_show_if_front_page', 'context' => 'normal', 'priority' => 'high', 'show_names' => true), $post_id);
     $field_id = $cmb_demo->add_field(array('name' => __('Test Multi Checkbox', 'cmb2'), 'desc' => __('field description (optional)', 'cmb2'), 'id' => $prefix . 'multicheckbox', 'type' => 'multicheck', 'multiple' => true, 'options' => array('check1' => __('Check One', 'cmb2'), 'check2' => __('Check Two', 'cmb2'), 'check3' => __('Check Three', 'cmb2'))));
     $field = $cmb_demo->get_field($field_id);
     $saved = $field->save_field($array_val);
     $this->assertEquals(2, $saved);
     $this->assertEquals($array_val, $field->get_data());
     $this->assertEquals($array_val, get_post_meta($post_id, $field_id));
     $val = get_post_meta($post_id, $field_id, 1);
     $this->assertEquals(reset($array_val), $val);
 }
 /**
  * Save all metadata for a term
  * @param  int $term_id         ID of the term metadata is for
  */
 public function save_meta_data($term_id)
 {
     if (!isset($_POST['taxonomy'])) {
         return;
     }
     $taxonomy_name = $_POST['taxonomy'];
     if (!current_user_can(get_taxonomy($taxonomy_name)->cap->edit_terms)) {
         return;
     }
     $metaboxes = apply_filters('cmb2-taxonomy_meta_boxes', array());
     foreach ($metaboxes as $key => $metabox) {
         if (!in_array($taxonomy_name, $metabox['object_types'])) {
             continue;
         }
         $cmb = cmb2_get_metabox($metabox, $term_id);
         if (isset($_POST[$cmb->nonce()]) && wp_verify_nonce($_POST[$cmb->nonce()], $cmb->nonce())) {
             $cmb->save_fields($term_id, 'term', $_POST);
         }
     }
 }
/**
 * Save fields data from an array of data (Likely $_POST data.)
 *
 * @link  https://wordpress.org/support/topic/sanitizing-data-outside-metabox-context Forum post
 *
 * @param  mixed  $meta_box_id  Metabox ID (or metabox config array)
 * @param  int    $object_id    ID of post/user/comment/options-page to save the data against
 * @param  array  $data_to_save Array of key => value data for saving. Likely $_POST data.
 */
function cmb2_save_metabox_fields_data($meta_box_id, $object_id, array $data_to_save)
{
    $cmb = cmb2_get_metabox($meta_box_id, $object_id);
    $cmb->save_fields($object_id, $cmb->object_type(), $data_to_save);
}
 /**
  * Save fields earlier in the load order (cmb2_after_init)
  *
  * @since  0.1.0
  */
 public function process_fields()
 {
     $presave_key = $this->get('consumer_key');
     if (!$this->get('url') && empty($_POST['url'])) {
         $_POST['api_url'] = null;
         $this->api()->delete_option();
     }
     if ($this->get('url') && empty($_POST['url']) || empty($_POST['consumer_key'])) {
         $this->api()->delete_option();
     }
     $api_url = false;
     if (!$this->get('api_url') && !empty($_POST['url'])) {
         $header_key = sanitize_text_field($_POST['header_key']);
         $header_token = sanitize_text_field($_POST['header_token']);
         $result = $this->do_discovery($_POST['url'], $header_key, $header_token);
         if (!is_wp_error($result)) {
             $_POST['api_url'] = $api_url = $result;
         }
     }
     // Save the fields
     $cmb = cmb2_get_metabox($this->metabox_id);
     $cmb->save_fields($this->key, $cmb->object_type('options-page'), $_POST);
     // If we' don't have the right stuff, we need to redirect to get authorization
     if (empty($presave_key) && !empty($_POST['consumer_key'])) {
         $this->api()->redirect_to_login();
     }
     // Redirect after saving to prevent refresh-saving
     $this->redirect();
 }
Beispiel #19
0
 public function test_cmb2_props()
 {
     $cmb = cmb2_get_metabox('test');
     // Test known state of all props except fields
     $prop_values = array('id' => 'test', 'title' => '', 'type' => '', 'object_types' => array(), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on_cb' => null, 'show_on' => array(), 'cmb_styles' => true, 'enqueue_js' => true, 'hookup' => true, 'save_fields' => true, 'closed' => false, 'new_user_section' => 'add-new-user');
     foreach ($prop_values as $prop_key => $expected_value) {
         $this->assertEquals($expected_value, $cmb->prop($prop_key));
     }
     // Test adding a new property
     $new_prop_name = 'new_prop';
     $new_prop_value = 'new value';
     $unused_fallback = 'should not be used';
     // Property is unset so the fallback should be used
     $prop_value = $cmb->prop($new_prop_name, $new_prop_value);
     $this->assertEquals($new_prop_value, $prop_value);
     // Property is now set so the fallback should not overwrite
     $prop_value = $cmb->prop($new_prop_name, $unused_fallback);
     $this->assertEquals($new_prop_value, $prop_value);
     // Test with no fallback specified
     $prop_value = $cmb->prop($new_prop_name);
     $this->assertEquals($new_prop_value, $prop_value);
     // The new property should show up in the meta_box array as well
     $prop_value = $cmb->meta_box[$new_prop_name];
     $this->assertEquals($new_prop_value, $prop_value);
 }
 /**
  * Builds the fields and saves them.
  *
  * @param array $args @since 1.1.0
  * @param string $id @since 1.1.0
  *
  * @since 1.0.1 Refactored the save tests to method should_save()
  * @since 1.0.0
  */
 public function metabox_callback($args, $id)
 {
     // get the metabox, fishing the ID out of the arguments array
     $cmb = cmb2_get_metabox($args[1]['id'], self::$props[$id]['key']);
     // save fields
     if ($this->should_save($cmb, $id)) {
         $cmb->save_fields(self::$props[$id]['key'], $cmb->mb_object_type(), $_POST);
     }
     // show the fields
     $cmb->show_form();
 }
Beispiel #21
0
 /**
  * Returns the CMB2 instance this field is registered to.
  *
  * @since  2.2.2
  *
  * @return CMB2|WP_Error If new CMB2_Field is called without cmb_id arg, returns error.
  */
 public function get_cmb()
 {
     if (!$this->cmb_id) {
         return new WP_Error('no_cmb_id', __('Sorry, this field does not have a cmb_id specified.', 'cmb2'));
     }
     return cmb2_get_metabox($this->cmb_id, $this->object_id, $this->object_type);
 }
Beispiel #22
0
 public function test_remove_field()
 {
     $cmb = cmb2_get_metabox('test2');
     $cmb->remove_field('group_field');
     $cmb->remove_field('group_field2');
     $this->assertEquals(array(array('name' => 'Test Name', 'id' => 'test_test', 'type' => 'textarea', 'attributes' => array('placeholder' => "I'm some placeholder text")), 'demo_text2' => array('name' => 'Test Text 2', 'desc' => 'Test Text 2 description', 'id' => 'demo_text2', 'type' => 'text', 'attributes' => array('placeholder' => "I'm some placeholder text"))), $cmb->prop('fields'));
 }
 /**
  * Use the passed-in CMB2 form args to retrieve a CMB2 object
  *
  * @since  0.1.0
  *
  * @return mixed Returns a CMB2 object or null;
  */
 public function get_cmb_object()
 {
     if (!function_exists('cmb2_metabox_form')) {
         return false;
     }
     if (isset($this->cmb_object)) {
         return $this->cmb_object;
     }
     $this->cmb_object = cmb2_get_metabox($this->get_cmb_config(), $this->button_slug);
     return $this->cmb_object;
 }
Beispiel #24
0
 /**
  * Defines the Google Places CPT metabox and field configuration
  * @since  1.0.0
  * @return array
  */
 public function cpt2_metaboxes_fields()
 {
     $prefix = 'gmb_';
     $default_options = $this->get_default_map_options();
     // MARKER WITH AUTOCOMPLETE
     $marker_box = cmb2_get_metabox(array('id' => 'google_maps_markers', 'title' => __('Map Markers', $this->plugin_slug), 'object_types' => array('google_maps'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
     $marker_box->add_field(array('name' => __('Create Marker', $this->plugin_slug), 'id' => $prefix . 'geocoder', 'type' => 'google_geocoder'));
     $group_field_id = $marker_box->add_field(array('name' => __('Existing Markers', $this->plugin_slug), 'id' => $prefix . 'markers_group', 'type' => 'group', 'description' => __('Map marker data is contained within the repeatable fields below. You may add or update marker data here or directly on the map.', $this->plugin_slug) . '<a href="#" class="button button-small toggle-repeater-groups">' . __('Toggle Marker Groups', $this->plugin_slug) . '</a>', 'options' => array('group_title' => __('Marker: {#}', 'cmb'), 'add_button' => __('Add Another Marker', $this->plugin_slug), 'remove_button' => __('Remove Marker', $this->plugin_slug), 'sortable' => true)));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Title', $this->plugin_slug), 'id' => 'title', 'type' => 'text'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Description', $this->plugin_slug), 'description' => __('Write a short description for this marker', $this->plugin_slug), 'id' => 'description', 'type' => 'textarea_small'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Reference', $this->plugin_slug), 'id' => 'reference', 'type' => 'text'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Place ID', $this->plugin_slug), 'id' => 'place_id', 'type' => 'text'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Hide Place Details', $this->plugin_slug), 'id' => 'hide_details', 'type' => 'checkbox'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Latitude', $this->plugin_slug), 'id' => 'lat', 'type' => 'text'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Longitude', $this->plugin_slug), 'id' => 'lng', 'type' => 'text'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Image', $this->plugin_slug), 'id' => 'marker_img', 'type' => 'file', 'row_classes' => 'gmb-hidden', 'options' => array('url' => false, 'add_upload_file_text' => __('Add Marker Image', $this->plugin_slug))));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Data', $this->plugin_slug), 'id' => 'marker', 'row_classes' => 'gmb-hidden', 'type' => 'textarea_code'));
     $marker_box->add_group_field($group_field_id, array('name' => __('Marker Label Data', $this->plugin_slug), 'id' => 'label', 'row_classes' => 'gmb-hidden', 'type' => 'textarea_code'));
     // PREVIEW
     $preview_box = cmb2_get_metabox(array('id' => 'google_maps_preview_metabox', 'title' => __('Google Map Preview', $this->plugin_slug), 'object_types' => array('google_maps'), 'context' => 'normal', 'priority' => 'high', 'show_names' => false));
     $preview_box->add_field(array('name' => __('Map Preview', $this->plugin_slug), 'id' => $prefix . 'preview', 'type' => 'google_maps_preview', 'default' => ''));
     // SEARCH OPTIONS
     $search_options = cmb2_get_metabox(array('id' => 'google_maps_search_options', 'title' => __('Google Places', $this->plugin_slug), 'object_types' => array('google_maps'), 'context' => 'normal', 'priority' => 'core', 'show_names' => true));
     $search_options->add_field(array('name' => __('Show Places?', $this->plugin_slug), 'desc' => __('Display establishments, prominent points of interest, geographic locations, and more.', $this->plugin_slug), 'id' => $prefix . 'show_places', 'type' => 'radio_inline', 'options' => array('yes' => __('Yes', 'cmb'), 'no' => __('No', 'cmb'))));
     $search_options->add_field(array('name' => __('Search Radius', $this->plugin_slug), 'desc' => __('Defines the distance (in meters) within which to return Place results. The maximum allowed radius is 50,000 meters.', $this->plugin_slug), 'default' => '1000', 'id' => $prefix . 'search_radius', 'type' => 'text_small'));
     $search_options->add_field(array('name' => __('Place Types', $this->plugin_slug), 'desc' => __('Select which type of places you would like to display on this map.', $this->plugin_slug), 'id' => $prefix . 'places_search_multicheckbox', 'type' => 'multicheck', 'options' => apply_filters('gmb_place_types', array('accounting' => __('Accounting', $this->plugin_slug), 'airport' => __('Airport', $this->plugin_slug), 'amusement_park' => __('Amusement Park', $this->plugin_slug), 'aquarium' => __('Aquarium', $this->plugin_slug), 'art_gallery' => __('Art Gallery', $this->plugin_slug), 'atm' => __('ATM', $this->plugin_slug), 'bakery' => __('Bakery', $this->plugin_slug), 'bank' => __('Bank', $this->plugin_slug), 'bar' => __('Bar', $this->plugin_slug), 'beauty_salon' => __('Beauty Salon', $this->plugin_slug), 'bicycle_store' => __('Bicycle Store', $this->plugin_slug), 'book_store' => __('Book Store', $this->plugin_slug), 'bowling_alley' => __('Bowling Alley', $this->plugin_slug), 'bus_station' => __('Bus Station', $this->plugin_slug), 'cafe' => __('Cafe', $this->plugin_slug), 'campground' => __('Campground', $this->plugin_slug), 'car_dealer' => __('Car Dealer', $this->plugin_slug), 'car_rental' => __('Car Rental', $this->plugin_slug), 'car_repair' => __('Car Repair', $this->plugin_slug), 'car_wash' => __('Car Wash', $this->plugin_slug), 'casino' => __('Casino', $this->plugin_slug), 'cemetery' => __('Cemetery', $this->plugin_slug), 'church' => __('Church', $this->plugin_slug), 'city_hall' => __('City Hall', $this->plugin_slug), 'clothing_store' => __('Clothing Store', $this->plugin_slug), 'convenience_store' => __('Convenience Store', $this->plugin_slug), 'courthouse' => __('Courthouse', $this->plugin_slug), 'dentist' => __('Dentist', $this->plugin_slug), 'department_store' => __('Department Store', $this->plugin_slug), 'doctor' => __('Doctor', $this->plugin_slug), 'electrician' => __('Electrician', $this->plugin_slug), 'electronics_store' => __('Electronics Store', $this->plugin_slug), 'embassy' => __('Embassy', $this->plugin_slug), 'establishment' => __('Establishment', $this->plugin_slug), 'finance' => __('Finance', $this->plugin_slug), 'fire_station' => __('Fire Station', $this->plugin_slug), 'florist' => __('Florist', $this->plugin_slug), 'food' => __('Food', $this->plugin_slug), 'funeral_home' => __('Funeral Home', $this->plugin_slug), 'furniture_store' => __('Furniture_store', $this->plugin_slug), 'gas_station' => __('Gas Station', $this->plugin_slug), 'general_contractor' => __('General Contractor', $this->plugin_slug), 'grocery_or_supermarket' => __('Grocery or Supermarket', $this->plugin_slug), 'gym' => __('Gym', $this->plugin_slug), 'hair_care' => __('Hair Care', $this->plugin_slug), 'hardware_store' => __('Hardware Store', $this->plugin_slug), 'health' => __('Health', $this->plugin_slug), 'hindu_temple' => __('Hindu Temple', $this->plugin_slug), 'home_goods_store' => __('Home Goods Store', $this->plugin_slug), 'hospital' => __('Hospital', $this->plugin_slug), 'insurance_agency' => __('Insurance Agency', $this->plugin_slug), 'jewelry_store' => __('Jewelry Store', $this->plugin_slug), 'laundry' => __('Laundry', $this->plugin_slug), 'lawyer' => __('Lawyer', $this->plugin_slug), 'library' => __('Library', $this->plugin_slug), 'liquor_store' => __('Liquor Store', $this->plugin_slug), 'local_government_office' => __('Local Government Office', $this->plugin_slug), 'locksmith' => __('Locksmith', $this->plugin_slug), 'lodging' => __('Lodging', $this->plugin_slug), 'meal_delivery' => __('Meal Delivery', $this->plugin_slug), 'meal_takeaway' => __('Meal Takeaway', $this->plugin_slug), 'mosque' => __('Mosque', $this->plugin_slug), 'movie_rental' => __('Movie Rental', $this->plugin_slug), 'movie_theater' => __('Movie Theater', $this->plugin_slug), 'moving_company' => __('Moving Company', $this->plugin_slug), 'museum' => __('Museum', $this->plugin_slug), 'night_club' => __('Night Club', $this->plugin_slug), 'painter' => __('Painter', $this->plugin_slug), 'park' => __('Park', $this->plugin_slug), 'parking' => __('Parking', $this->plugin_slug), 'pet_store' => __('Pet Store', $this->plugin_slug), 'pharmacy' => __('Pharmacy', $this->plugin_slug), 'physiotherapist' => __('Physiotherapist', $this->plugin_slug), 'place_of_worship' => __('Place of Worship', $this->plugin_slug), 'plumber' => __('Plumber', $this->plugin_slug), 'police' => __('Police', $this->plugin_slug), 'post_office' => __('Post Office', $this->plugin_slug), 'real_estate_agency' => __('Real Estate Agency', $this->plugin_slug), 'restaurant' => __('Restaurant', $this->plugin_slug), 'roofing_contractor' => __('Roofing Contractor', $this->plugin_slug), 'rv_park' => __('RV Park', $this->plugin_slug), 'school' => __('School', $this->plugin_slug), 'shoe_store' => __('Shoe Store', $this->plugin_slug), 'shopping_mall' => __('Shopping Mall', $this->plugin_slug), 'spa' => __('Spa', $this->plugin_slug), 'stadium' => __('Stadium', $this->plugin_slug), 'storage' => __('Storage', $this->plugin_slug), 'store' => __('Store', $this->plugin_slug), 'subway_station' => __('Subway Station', $this->plugin_slug), 'synagogue' => __('Synagogue', $this->plugin_slug), 'taxi_stand' => __('Taxi Stand', $this->plugin_slug), 'train_station' => __('Train Station', $this->plugin_slug), 'travel_agency' => __('Travel Agency', $this->plugin_slug), 'university' => __('University', $this->plugin_slug), 'veterinary_care' => __('Veterinary Care', $this->plugin_slug), 'zoo' => __('Zoo', $this->plugin_slug)))));
     /**
      * Display Options
      */
     $display_options = cmb2_get_metabox(array('id' => 'google_maps_options', 'title' => __('Display Options', $this->plugin_slug), 'object_types' => array('google_maps'), 'context' => 'side', 'priority' => 'default', 'show_names' => true));
     $display_options->add_field(array('name' => __('Map Size', $this->plugin_slug), 'id' => $prefix . 'width_height', 'type' => 'width_height', 'width_std' => $default_options['width'], 'width_unit_std' => $default_options['width_unit'], 'height_std' => $default_options['height'], 'desc' => ''));
     $display_options->add_field(array('name' => __('Map Location', $this->plugin_slug), 'id' => $prefix . 'lat_lng', 'type' => 'lat_lng', 'lat_std' => '', 'lng_std' => '', 'desc' => ''));
     $display_options->add_field(array('name' => __('Map Type', $this->plugin_slug), 'id' => $prefix . 'type', 'type' => 'select', 'default' => 'default', 'options' => array('RoadMap' => __('Road Map', $this->plugin_slug), 'Satellite' => __('Satellite', $this->plugin_slug), 'Hybrid' => __('Hybrid', $this->plugin_slug), 'Terrain' => __('Terrain', $this->plugin_slug))));
     $display_options->add_field(array('name' => 'Map Theme', 'desc' => sprintf(__('Set optional preconfigured %1$sSnazzy Maps%2$s styles. %3$sUpgrade to Pro%2$s for more styles and to set your own.', $this->plugin_slug), '<a href="' . esc_url('http://snazzymaps.com') . '" class="snazzy-link new-window"  target="_blank">', '</a>', '<a href="' . esc_url('https://wordimpress.com/plugins/maps-builder-pro/?utm_source=MBF&utm_medium=BANNER&utm_term=MAP_OPTIONS&utm_campaign=MBF') . '" class="new-window"  target="_blank">'), 'id' => $prefix . 'theme', 'type' => 'select', 'default' => 'none', 'options' => array('none' => __('None', $this->plugin_slug), '68' => __('Aqua', $this->plugin_slug), '73' => __('A Dark World', $this->plugin_slug), '28' => __('Bluish', $this->plugin_slug), '80' => __('Cool Grey', $this->plugin_slug), '77' => __('Clean Cut', $this->plugin_slug), '36' => __('Flat Green', $this->plugin_slug), '44' => __('MapBox', $this->plugin_slug), '83' => __('Muted Blue', $this->plugin_slug), '22' => __('Old Timey', $this->plugin_slug), '1' => __('Pale Dawn', $this->plugin_slug), '19' => __('Paper', $this->plugin_slug), '37' => __('Lunar Landscape', $this->plugin_slug), '75' => __('Shade of Green', $this->plugin_slug), '27' => __('Shift Worker', $this->plugin_slug), '15' => __('Subtle Grayscale', $this->plugin_slug), '50' => __('The Endless Atlas', $this->plugin_slug))));
     $display_options->add_field(array('name' => __('Map Theme JSON', $this->plugin_slug), 'desc' => 'Contains the map theme JSON', 'row_classes' => 'hidden', 'default' => 'none', 'id' => $prefix . 'theme_json', 'type' => 'textarea_code'));
     $display_options->add_field(array('name' => 'Zoom', 'desc' => __('Adjust the map zoom (0-21)', $this->plugin_slug), 'id' => $prefix . 'zoom', 'type' => 'select', 'default' => '15', 'options' => apply_filters('gmb_map_zoom_levels', array('21' => '21', '20' => '20', '19' => '19', '18' => '18', '17' => '17', '16' => '16', '15' => '15', '14' => '14', '13' => '13', '12' => '12', '11' => '11', '10' => '10', '9' => '9', '8' => '8', '7' => '7', '6' => '6', '5' => '5', '4' => '4', '3' => '3', '2' => '2', '1' => '1', '0' => '0'))));
     // CONTROL OPTIONS
     $control_options = cmb2_get_metabox(array('id' => 'google_maps_control_options', 'title' => __('Map Controls', $this->plugin_slug), 'object_types' => array('google_maps'), 'context' => 'side', 'priority' => 'default', 'show_names' => true));
     $control_options->add_field(array('name' => __('Zoom Control', $this->plugin_slug), 'before' => '<span class="gmb-tooltip-text">' . __('Test test 123', $this->plugin_slug) . '</span>', 'row_classes' => 'gmb-tooltip-field', 'id' => $prefix . 'zoom_control', 'type' => 'select', 'default' => 'default', 'options' => array('none' => __('None', $this->plugin_slug), 'small' => __('Small', $this->plugin_slug), 'large' => __('Large', $this->plugin_slug), 'default' => __('Default', $this->plugin_slug))));
     $control_options->add_field(array('name' => __('Street View', $this->plugin_slug), 'id' => $prefix . 'street_view', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', $this->plugin_slug), 'true' => __('Standard', $this->plugin_slug))));
     $control_options->add_field(array('name' => __('Pan Control', $this->plugin_slug), 'id' => $prefix . 'pan', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', $this->plugin_slug), 'true' => __('Standard', $this->plugin_slug))));
     $control_options->add_field(array('name' => __('Map Type Control', $this->plugin_slug), 'id' => $prefix . 'map_type_control', 'type' => 'select', 'default' => 'horizontal_bar', 'options' => array('none' => __('None', $this->plugin_slug), 'dropdown_menu' => __('Dropdown Menu', $this->plugin_slug), 'horizontal_bar' => __('Horizontal Bar', $this->plugin_slug))));
     $control_options->add_field(array('name' => __('Draggable Map', $this->plugin_slug), 'id' => $prefix . 'draggable', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', $this->plugin_slug), 'true' => __('Standard', $this->plugin_slug))));
     $control_options->add_field(array('name' => __('Double Click to Zoom', $this->plugin_slug), 'id' => $prefix . 'double_click', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', $this->plugin_slug), 'true' => __('Standard', $this->plugin_slug))));
     $control_options->add_field(array('name' => __('Mouse Wheel to Zoom', $this->plugin_slug), 'id' => $prefix . 'wheel_zoom', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('Disabled', $this->plugin_slug), 'true' => __('Standard', $this->plugin_slug))));
 }
function get_parinite()
{
    $metabox_id = '_frontend_form';
    $object_id = 'fake-object-id';
    return cmb2_get_metabox($metabox_id, $object_id);
}