ACF Table Field Pro Add-on Docs Last updated:

Parent sources

On this page

Since version: v1.8.0

Release Candidate 1.8.0-RC1

This page documents version 1.8.0, which is available as Release Candidate 1.8.0-RC1 for manual installation. The current public version is 1.7.6, automatic plugin updates still deliver that version.

Download the Release Candidate from your account (Download the plugin) and install it manually (Install the plugin). Details may still change until the final release.

Filter acf_tablefield/formatting/font_weights

New since version 1.8.0

This filter is new.

This filter changes the font weights that the table editor offers for the formatting option font weight. By default the plugin offers the weights that the font of the table has in the theme: the font faces of the font family of the table block in the global styles, from the theme.json or the font library. If the weights are not known, the editor offers Bold and Normal.

The list only decides what the editor offers. Any stored font weight from 100 to 900 stays valid, is shown in the editor and is output on the website.

Parameters

add_filter( 'acf_tablefield/formatting/font_weights', function( $weights, $context ) { 
 
	// offer 300, 400 and 600 for one field 
	if ( 'field_62a9b0c1d2e3f' === $context['field_key'] ) { 
 
		return array( 300, 400, 600 ); 
	} 
 
	return $weights; 
}, 10, 2 );
    • $weights
    • (array)
    • The font weights, for example array( '400', '700' ). Strings or integers are accepted. The result is normalized, see below.

    • $context
    • (array)
    • Information about the field: field_key (the key of the ACF field), post_id, font_family (the slug of the font family of the table in the global styles, or an empty string) and source where the weights come from: theme_json, font_library or none.

Normalization

The returned list is normalized: normal becomes 400, bold becomes 700, a range like 200 800 becomes every hundred inside the range, and a single value is only kept if it is a multiple of 100 from 100 to 900. A value like 450 is dropped. The result has every weight once and is sorted. An empty list means that the editor offers Bold and Normal.

Previous and Next Sources

Parent sources