Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Use this hook to allow filtering the inner content of a grid view before the wrapper element is added.
Usage
add_filter( 'frm_display_inner_content_before_add_wrapper', 'custom_function', 10, 3 );
Parameters
- $inner_content (string): The inner content.
- $view (object) : View object.
- $args (array) :
- $entry_ids (array): Entry ids on the current page.
- $total_count (int): Number of entries on the current page.
- $record_count (int): Total number of entries.
- $pagination (string): HTML of pagination.
- $is_table_view (bool): Check if it is a table view
- $is_grid_view (bool): Check if it is a grid view
- $box_content (array): The data of grid boxes or table columns.
Examples
Wrap all grid items inside a custom wrapper
add_filter( 'frm_display_inner_content_before_add_wrapper', 'grid_view_custom_wrapper', 10, 3 );
function grid_view_custom_wrapper( $inner_content, $view, $args ) {
if ( ! empty( $args['is_grid_view'] ) ) {
$inner_content = '<div class="frm_grid_container">' . $inner_content . '</div>';
}
return $inner_content;
}
Show total of items at the end of a table view
add_filter( 'frm_display_inner_content_before_add_wrapper', 'table_view_total_row', 10, 3 );
function table_view_total_row( $inner_content, $view, $args ) {
if ( ! empty( $args['is_table_view'] ) ) {
$total_columns = count( $args['box_content'] );
$total_items = count( $args['record_count'] );
$inner_content .= '<tr><td colspan="' . intval( $total_columns ) . '">Total items: ' . intval( $total_items ) . '</td></tr>';
}
return $inner_content;
}