ACF_Admin_Field_Groups::render_admin_table_column_num_fieldspublicACF 6.1.5

Renders the number of fields created for the field group in the list table.

Method of the class: ACF_Admin_Field_Groups{}

No Hooks.

Returns

void. Nothing (null).

Usage

$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups();
$ACF_Admin_Field_Groups->render_admin_table_column_num_fields( $field_group );
$field_group(array) (required)
The main field group array.

Changelog

Since 6.1.5 Introduced.

ACF_Admin_Field_Groups::render_admin_table_column_num_fields() code ACF 6.8.8

public function render_admin_table_column_num_fields( $field_group ) {
	$field_count = acf_get_field_count( $field_group );

	if ( ! $field_count || ! is_numeric( $field_count ) ) {
		echo '<span class="acf-emdash" aria-hidden="true">—</span>';
		echo '<span class="screen-reader-text">' . esc_html__( 'No fields', 'acf' ) . '</span>';
		return;
	}

	// If in JSON but not synced or in trash, the link won't work.
	if ( empty( $field_group['ID'] ) || 'trash' === get_post_status( $field_group['ID'] ) ) {
		echo esc_html( number_format_i18n( $field_count ) );
		return;
	}

	printf(
		'<a href="%s">%s</a>',
		esc_url( admin_url( 'post.php?action=edit&post=' . $field_group['ID'] ) ),
		esc_html( number_format_i18n( $field_count ) )
	);
}