JPry

custom-metaboxes.php

Oct 28th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.42 KB | None | 0 0
  1. <?php
  2.  
  3. global $meta_prefix; // In case this needs to be global at some point.
  4.  
  5. add_filter( 'cmb_meta_boxes', 'tsgkb_custom_metabox' );
  6. function tsgkb_custom_metabox( $meta_boxes ) {
  7.     global $meta_prefix;
  8.  
  9.     /* Problem meta box */
  10.     $meta_boxes[] = array(
  11.         'id' => 'problem_details',
  12.         'title' => 'Problem Details',
  13.         'pages' => array( 'ps_set' ),
  14.         'context' => 'normal',
  15.         'priority' => 'high',
  16.         'show_names' => true,
  17.         'fields' => array(
  18.             array(
  19.                 'name' => 'Prefix',
  20.                 'id' => $meta_prefix . 'title-prefix',
  21.                 'desc' => 'The prefix is: ' . $meta_prefix,
  22.                 'type' => 'title'
  23.             ),
  24.             array(
  25.                 'name' => 'Product',
  26.                 'id' => $meta_prefix . 'product',
  27.                 'desc' => 'Pick the affected Product',
  28.                 'type' => 'taxonomy_select',
  29.                 'taxonomy' => 'product'
  30.             ),
  31.             array(
  32.                 'name' => 'Sales Name',
  33.                 'id' => $meta_prefix . 'sales-name',
  34.                 'desc' => 'The official Product sales name',
  35.                 'type' => 'taxonomy_select',
  36.                 'taxonomy' => 'sales_name'
  37.             ),
  38.             array(
  39.                 'name' => 'Version',
  40.                 'id' => $meta_prefix . 'version',
  41.                 'desc' => 'Enter the Version',
  42.                 'type' => 'text_small'
  43.             ),
  44.             array(
  45.                 'name' => 'Area',
  46.                 'id' => $meta_prefix . 'area',
  47.                 'desc' => 'Enter the Area',
  48.                 'type' => 'taxonomy_select',
  49.                 'taxonomy' => 'area'
  50.             ),
  51.             array(
  52.                 'name' => 'TR/CR',
  53.                 'id' => $meta_prefix . 'tr-cr',
  54.                 'desc' => 'Select Trouble Report or Change Request if applicable',
  55.                 'type' => 'radio',
  56.                 'options' => array(
  57.                     array( 'name' => 'TR', 'value' => 'tr' ),
  58.                     array( 'name' => 'CR', 'value' => 'cr' )
  59.                 )
  60.             ),
  61.             array(
  62.                 'name' => 'TR/CR number',
  63.                 'id' => $meta_prefix . 'tr-cr-number',
  64.                 'desc' => 'The number for the TR/CR',
  65.                 'type' => 'text_small'
  66.             ),
  67.             array(
  68.                 'name' => 'Problem Long Text',
  69.                 'id' => $meta_prefix . 'problem-text',
  70.                 'desc' => 'Enter the full details of the problem here.',
  71.                 'type' => 'wysiwyg'
  72.             )
  73.         )
  74.     );
  75.  
  76.     /* Solution meta box */
  77.     $meta_boxes[] = array(
  78.         'id' => 'solution_details',
  79.         'title' => 'Solution Details',
  80.         'pages' => array( 'ps_set' ),
  81.         'context' => 'normal',
  82.         'priority' => 'high',
  83.         'show_names' => true,
  84.         'fields' => array(
  85.             array(
  86.                 'name' => 'Workaround',
  87.                 'id' => $meta_prefix . 'workaround',
  88.                 'desc' => 'The Workarond, if applicable',
  89.                 'type' => 'textarea_small'
  90.             ),
  91.             array(
  92.                 'name' => 'Solution Long Text',
  93.                 'id' => $meta_prefix . 'solution-text',
  94.                 'desc' => 'Enter the full details of the solution here.',
  95.                 'type' => 'wysiwyg'
  96.             )
  97.         )
  98.     );
  99.  
  100.     return $meta_boxes;
  101. }
  102.  
  103. ?>
  104.  
Advertisement
Add Comment
Please, Sign In to add comment