acf_get_grouped_field_types()ACF 5.0.0

acf_get_grouped_field_types

Returns an multi-dimentional array of field types "name => label" grouped by category

Хуки из функции

Возвращает

(Массив).

Использование

acf_get_grouped_field_types();

Список изменений

С версии 5.0.0 Введена.

Код acf_get_grouped_field_types() 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;
}