Advertisement
angelorocha

cmb2_group_fields_filelist

Sep 10th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. add_action('cmb2_init', 'omni_central_metabox');
  2.  
  3. function omni_central_metabox() {
  4.     $prefix = '_omni_';
  5.  
  6.     // Anexos do Portfolio
  7.     $portfolioAnexos = new_cmb2_box(array(
  8.         'id' => 'portfolio-anexos',
  9.         'title' => 'Anexos',
  10.         'object_types' => array('central-conhecimento'),
  11.         'context' => 'normal',
  12.         'priority' => 'high',
  13.         'closed' => true,
  14.     ));
  15.  
  16.     $group_field_id = $portfolioAnexos->add_field(array(
  17.         'id' => 'portfolio_anexos_repeat',
  18.         'type' => 'group',
  19.         'description' => __('Anexos do portfólio', 'omni'),
  20.         'options' => array(
  21.             'group_title' => __('Grupo {#}', 'omni'),
  22.             'add_button' => __('Novo Grupo', 'omni'),
  23.             'remove_button' => __('Remover Grupo', 'omni'),
  24.             'sortable' => true,
  25.         ),
  26.     ));
  27.  
  28.     $portfolioAnexos->add_group_field($group_field_id, array(
  29.         'name' => 'Título do Grupo de Anexos',
  30.         'id' => $prefix . 'grupo_anexo_title',
  31.         'type' => 'text',
  32.     ));
  33.  
  34.     $portfolioAnexos->add_group_field($group_field_id, array(
  35.         'name' => 'Enviar Anexos',
  36.         'desc' => '',
  37.         'id' => $prefix . 'portfolio_attachment_list',
  38.         'type' => 'file_list',
  39.         'options' => array(
  40.             'add_upload_files_text' => 'Adicionar',
  41.             'remove_image_text' => 'Remover',
  42.             'file_text' => 'Anexo',
  43.             'file_download_text' => 'Download',
  44.             'remove_text' => 'Remover',
  45.         ),
  46.     ));
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement