<?php
add_action('cmb2_admin_init', 'alt_metabox_popups',1);

/**
 * Define the metabox and field configurations.
 */
function alt_metabox_popups()
{


    $cmb = new_cmb2_box(array(
        'id' => 'field_popups',
        'title' => 'Configurações',
        'object_types' => array('popups'), // Post type
        'context' => 'normal',
        'priority' => 'high',
        'show_names' => true,
        'show_in_rest' => WP_REST_Server::ALLMETHODS,
    ));


    $opcoes = [
        'entrada'=>'Ao entrada no site',
        'saida'=>'Ao sair do site'
    ];


    $cmb->add_field(array(
        'name' => 'Quando será exibido o popup?',
        'desc' => '',
        'id' => 'tempo_exibicao',
        'type' => 'select',
        'default' => 'entrada',
        'options' => $opcoes,
    ));

}
