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_sizes

New since version 1.8.0

This filter is new.

This filter changes the list of the font sizes of the formatting option font size. You can add sizes, remove sizes, change their values or their order. The sizes are used in the table editor, in the Table Manager (the option font_size), in the REST schema and for the output, see cell formatting.

The filter is global. It has no field parameter, because the sizes are part of the Table Manager values and the REST schema, which have no field.

Parameters

add_filter( 'acf_tablefield/formatting/font_sizes', function( $sizes ) { 
 
	// add a size 
	$sizes['xs'] = array( 
		'name'  => 'extra-small', 
		'label' => 'Extra small', 
		'value' => '0.75em', 
	); 
 
	// change the value of the size large to a size of the theme 
	$sizes['l']['value'] = 'var(--wp--preset--font-size--large)'; 
 
	return $sizes; 
} );
    • $sizes
    • (array)
    • The font sizes. The array keys are the stored keys of the sizes, the values are arrays with the entries name, label and value. The default sizes are listed below. The order is the order in the table editor.

Entries of a size

Entries of a size

Entry Description
array key The stored key and the part of the token: fz-<key>. One or two characters from a-z and 0-9, starting with a letter, unique. th is not allowed, it is the value for the theme.
name The public value, used by the Table Manager. Words from a-z and 0-9, joined by -, unique. theme is not allowed. Default is the key.
label The name in the table editor. Default is the name.
value The CSS value of font-size, at most 100 characters from a-z, A-Z, 0-9 and . % ( ) , + - * / and the space. For example 12px, clamp(1rem, 2vw, 2rem) or var(--wp--preset--font-size--large). Required.

Default sizes

Key Name Label Value
s small Small 0.875em
m medium Medium 1em
l large Large 1.25em
xl x-large Extra large 1.5em

An invalid entry is dropped. The list is read once, after the action after_setup_theme. Add the filter in a plugin or in the functions.php of the theme, not later.

A size that is not one of the default sizes or has another value gets CSS that the plugin generates for the website. It is added inline directly after the stylesheet formatting.css. If the filter acf_tablefield/formatting/enqueue_style returns false, this CSS is not output, and your theme has to style the token fz-<key> itself.

If you remove a size, the tables that use it keep the stored key. The key has no effect until the size is in the list again. The Table Manager returns the stored key for such a size.

Previous and Next Sources

Parent sources