Beispiel #1
0
 function get_field_groups($field_groups)
 {
     // validate
     if (!acf_have_local_field_groups()) {
         return $field_groups;
     }
     // vars
     $ignore = array();
     $added = false;
     // populate ignore list
     if (!empty($field_groups)) {
         foreach ($field_groups as $k => $group) {
             $ignore[] = $group['key'];
         }
     }
     // append field groups
     $groups = acf_get_local_field_groups();
     foreach ($groups as $group) {
         // is ignore
         if (in_array($group['key'], $ignore)) {
             continue;
         }
         // append
         $field_groups[] = $group;
         $added = true;
     }
     // order field groups based on menu_order, title
     if ($added) {
         $menu_order = array();
         $title = array();
         foreach ($field_groups as $key => $row) {
             $menu_order[$key] = $row['menu_order'];
             $title[$key] = $row['title'];
         }
         // sort the array with menu_order ascending
         array_multisort($menu_order, SORT_ASC, $title, SORT_ASC, $field_groups);
     }
     // return
     return $field_groups;
 }
 function get_field_groups($field_groups)
 {
     // validate
     if (!acf_have_local_field_groups()) {
         return $field_groups;
     }
     // vars
     $ignore = array();
     // overrride field groups and populate ignore list
     if (!empty($field_groups)) {
         foreach ($field_groups as $k => $group) {
             // override
             if (acf_is_local_field_group($group['key'])) {
                 $field_groups[$k] = acf_get_local_field_group($group['key']);
             }
             $ignore[] = $group['key'];
         }
     }
     // append field groups
     $groups = acf_get_local_field_groups();
     foreach ($groups as $group) {
         if (!in_array($group['key'], $ignore)) {
             $field_groups[] = $group;
         }
     }
     // order field groups based on menu_order, title
     $menu_order = array();
     $title = array();
     foreach ($field_groups as $key => $row) {
         $menu_order[$key] = $row['menu_order'];
         $title[$key] = $row['title'];
     }
     // sort the array with menu_order ascending
     array_multisort($menu_order, SORT_ASC, $title, SORT_ASC, $field_groups);
     // return
     return $field_groups;
 }