yourprefix_render_row_cb

Manually render a field.

Description

yourprefix_render_row_cb( (array) $field_args, (CMB2_Field) $field ); 

Parameters (2)

0. $field_args (array)
Array of field arguments.
1. $field (CMB2_Field)
The field object

Usage

  1. if ( !function_exists( 'yourprefix_render_row_cb' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'cmb2/example-functions.php'; 
  3.  
  4. // Array of field arguments. 
  5. $field_args = array(); 
  6.  
  7. // The field object 
  8. $field = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = yourprefix_render_row_cb($field_args, $field); 
  12.  

Defined (1)

The function is defined in the following location(s).

/example-functions.php  
  1. function yourprefix_render_row_cb( $field_args, $field ) { 
  2. $classes = $field->row_classes(); 
  3. $id = $field->args( 'id' ); 
  4. $label = $field->args( 'name' ); 
  5. $name = $field->args( '_name' ); 
  6. $value = $field->escaped_value(); 
  7. $description = $field->args( 'description' ); 
  8. ?> 
  9. <div class="custom-field-row <?php echo $classes; ?>"> 
  10. <p><label for="<?php echo $id; ?>"><?php echo $label; ?></label></p> 
  11. <p><input id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>" value="<?php echo $value; ?>"/></p> 
  12. <p class="description"><?php echo $description; ?></p> 
  13. </div> 
  14. <?php