Filter acf_tablefield/get_table/attr/section
This filter enables filtering table section HTML element (tbody, thead, tfoot
) attributes using get_table()
or other table HTML returning functions and methodes.
Parameters
add_filter( 'acf_tablefield/get_table/attr/section', function( $attr, $data ) {
if( 'tbody' !== $data['section_key'] ) {
return $attr;
}
$attr['class'][] = 'highlighted';
return $attr;
}, 10, 2 );
-
$attr
A key value pair array of the html element attributes.
-
$data['field']
ACF field oject
-
$data['selector']
Field name or key
-
$data['post_id']
The post ID
-
$data['section_key']
The table section like thead, tbody or tfoot
-
$data['item_data']
The data of the current table cell
-
$data['table_data']
The data of the table
-
$data['manager_id']
The table manager id if set.
Result
<tbody class="highlighted"></tbody>