acf_get_grouped_field_types()
acf_get_grouped_field_types
Returns an multi-dimentional array of field types "name => label" grouped by category
Hooks from the function
Returns
(Array).
Usage
acf_get_grouped_field_types();
Changelog
| Since 5.0.0 | Introduced. |
acf_get_grouped_field_types() acf get grouped field types code ACF 6.0.4
function acf_get_grouped_field_types() {
// vars
$types = acf_get_field_types();
$groups = array();
$l10n = array(
'basic' => __( 'Basic', 'acf' ),
'content' => __( 'Content', 'acf' ),
'choice' => __( 'Choice', 'acf' ),
'relational' => __( 'Relational', 'acf' ),
'jquery' => __( 'jQuery', 'acf' ),
'layout' => __( 'Layout', 'acf' ),
);
// loop
foreach ( $types as $type ) {
// translate
$cat = $type->category;
$cat = isset( $l10n[ $cat ] ) ? $l10n[ $cat ] : $cat;
// append
$groups[ $cat ][ $type->name ] = $type->label;
}
// filter
$groups = apply_filters( 'acf/get_field_types', $groups );
// return
return $groups;
}