ACF_Rest_Api::get_field_groups_by_object_type()privateACF 1.0

Get all field groups for the provided object type.

Метод класса: ACF_Rest_Api{}

Хуков нет.

Возвращает

Массив. An array of field groups that display for that location type.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_field_groups_by_object_type( $object_type );
$object_type(строка) (обязательный)
'user', 'term', or 'post'

Код ACF_Rest_Api::get_field_groups_by_object_type() ACF 6.0.4

private function get_field_groups_by_object_type( $object_type ) {
	$field_groups       = acf_get_field_groups();
	$location_types     = acf_get_location_types();
	$object_type_groups = array();

	foreach ( $field_groups as $field_group ) {
		if ( empty( $field_group['show_in_rest'] ) ) {
			continue;
		}

		if ( $this->object_type_has_field_group( $object_type, $field_group, $location_types ) ) {
			$object_type_groups[] = $field_group;
		}
	}

	return $object_type_groups;
}