api_acf_get_field_groups

The Advanced Custom Fields api acf get field groups function.

Description

api_acf_get_field_groups( $return ); 

Parameters (1)

0. $return
The return.

Usage

  1. if ( !function_exists( 'api_acf_get_field_groups' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'advanced-custom-fields/core/api.php'; 
  3.  
  4. // The return. 
  5. $return = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = api_acf_get_field_groups($return); 
  9.  

Defined (1)

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

/core/api.php  
  1. function api_acf_get_field_groups( $return ) 
  2. // validate 
  3. if( empty($GLOBALS['acf_register_field_group']) ) 
  4. return $return; 
  5.  
  6.  
  7. foreach( $GLOBALS['acf_register_field_group'] as $acf ) 
  8. $return[] = array( 
  9. 'id' => $acf['id'],  
  10. 'title' => $acf['title'],  
  11. 'menu_order' => $acf['menu_order'],  
  12. ); 
  13.  
  14.  
  15. // order field groups based on menu_order, title 
  16. // Obtain a list of columns 
  17. foreach( $return as $key => $row ) 
  18. $menu_order[ $key ] = $row['menu_order']; 
  19. $title[ $key ] = $row['title']; 
  20.  
  21. // Sort the array with menu_order ascending 
  22. // Add $array as the last parameter, to sort by the common key 
  23. if(isset($menu_order)) 
  24. array_multisort($menu_order, SORT_ASC, $title, SORT_ASC, $return); 
  25.  
  26. return $return;