pods_group_add

Add a meta group of fields to add/edit forms.

Description

pods_group_add( (string|array) $pod, (string) $label, (string|array) $fields, (string) $context = 'normal', (string) $priority = 'default', (null) $type = null ); 

Parameters (6)

0. $pod (string|array)
The pod or type of element to attach the group to.
1. $label (string)
Title of the edit screen section, visible to user.
2. $fields (string|array)
Either a comma separated list of text fields or an associative array containing field information.
3. $context — Optional. (string) => 'normal'
The part of the page where the edit screen section should be shown ('normal', advanced,, or side).
4. $priority — Optional. (string) => 'default'
The priority within the context where the boxes should show ('high', core,, default or low).
5. $type — Optional. (null) => null
Type of the post to attach to.

Usage

  1. if ( !function_exists( 'pods_group_add' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/general.php'; 
  3.  
  4. // The pod or type of element to attach the group to. 
  5. $pod = null; 
  6.  
  7. // Title of the edit screen section, visible to user. 
  8. $label = ''; 
  9.  
  10. // Either a comma separated list of text fields or an associative array containing field information. 
  11. $fields = null; 
  12.  
  13. // (optional) The part of the page where the edit screen section should be shown ('normal', 'advanced', or 'side'). 
  14. $context = 'normal'; 
  15.  
  16. // (optional) The priority within the context where the boxes should show ('high', 'core', 'default' or 'low'). 
  17. $priority = 'default'; 
  18.  
  19. // (optional) Type of the post to attach to. 
  20. $type = null; 
  21.  
  22. // NOTICE! Understand what this does before running. 
  23. $result = pods_group_add($pod, $label, $fields, $context, $priority, $type); 
  24.  

Defined (1)

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

/includes/general.php  
  1. function pods_group_add ( $pod, $label, $fields, $context = 'normal', $priority = 'default', $type = null ) { 
  2. if ( !is_array( $pod ) && null !== $type ) { 
  3. $pod = array( 
  4. 'name' => $pod,  
  5. 'type' => $type 
  6. ); 
  7.  
  8. pods_meta()->group_add( $pod, $label, $fields, $context, $priority );