Since version: v1.8.0
Filter acf_tablefield/formatting/cell_tokens
This filter changes the formatting tokens of a table cell before they are output as the attribute data-acftf-format. See Cell formatting.
The tokens are the resolved values of the nine formatting options, see formatting options and values. A token is the prefix of the option plus the public value: va-middle, ha-start, fw-700, fs-italic, td-underline, tt-uppercase, ws-nowrap and nv-tabular. The font size is the prefix plus the stored key of the size: fz-l. An option that resolves to the theme or is not set anywhere has no token. The tokens come in the order of the options as listed here.
If the filter returns an empty array, the cell gets no attribute and does not load the stylesheet.
Parameters
add_filter( 'acf_tablefield/formatting/cell_tokens', function( $tokens, $table_data, $section_key, $row_index, $col_index ) {
// replace the token for the font weight 700 with an own token
foreach ( $tokens as $index => $token ) {
if ( 'fw-700' === $token ) {
$tokens[ $index ] = 'fw-heavy';
}
}
return $tokens;
}, 10, 5 );
-
$tokensThe formatting tokens of the cell, for example
array( 'va-middle', 'fw-700' ). Options that resolve to the theme or have no value have no token.
-
$table_dataThe raw data of the table, as it is stored (with the short keys).
-
$section_keyThe key of the table section:
h(header),b(body) orf(footer).
-
$row_indexThe index of the row within its section, starting at 0.
-
$col_indexThe index of the column, starting at 0.
Result
<td data-acftf-format="fw-heavy"></td>