Filterscell_tokensJSRelease Candidate1.8.0
Since version: v1.8.0
Filter formatting cell_tokens
This filter changes the formatting tokens of a data cell in the table editor. It is the JavaScript counterpart of the PHP filter acf_tablefield/formatting/cell_tokens. It runs after the tokens of the cell are resolved from the cell, row, column, area and table options. The table editor sets the result as the attribute data-acftf-format of the cell.
ACFTableFieldPro.core.addFilter( 'formatting', 'cell_tokens', function( tokens, param ) {
/*
param = {
table: {}, // the table object
cell: $td, // the jQuery object of the cell
sectionKey: 'b', // h, b or f
rowIndex: 0, // row index within the section, starting at 0
colIndex: 0, // column index, starting at 0
}
*/
// replace the token for the font weight 700 with an own token
return tokens.map( function( token ) {
return token === 'fw-700' ? 'fw-heavy' : token;
} );
} );
tokens is an array of strings. param.rowIndex and param.colIndex start at 0 like the indexes in the PHP filter. The column index is the physical one: it also counts cells that are hidden by a span.