PDF for GravityView Hooks – gfpdf_gv_static_map_caption
Description
Use this filter to reword or hide the caption under the Multiple Entries Map widget. The caption only appears when some entries in the PDF aren't on the map, and reads:
Map shows 42 of 60 entries.
Entries are left off when they have no location or the map reached its marker limit. See Maps in PDFs. Entry Map fields never have a caption.
Version
This hook was introduced in PDF for GravityView 2.0.
Arguments
The following arguments are passed to functions that use this hook:
$caption | string
- The caption text, translated, with the numbers formatted for the site's locale.
- Return plain text. It's escaped and wrapped in
<p class="gfpdf-static-map-caption">for you. - Return an empty string to hide it.
- The default value is
'Map shows X of Y entries.'when an entry was left off, and''when none were.
$represented | int
- The number of entries with at least one marker on the map.
$total | int
- The number of entries in the PDF.
$view | \GV\View
- The View being rendered.
Usage
Hide the caption on every map:
add_filter( 'gfpdf_gv_static_map_caption', '__return_empty_string' );
Explain why entries are missing:
add_filter( 'gfpdf_gv_static_map_caption', function( $caption, $represented, $total ) {
if ( $caption === '' ) {
return $caption;
}
return sprintf(
'%1$d of %2$d entries are shown on the map. The others have no address on file.',
$represented,
$total
);
}, 10, 3 );
To style the caption, target the gfpdf-static-map-caption class in your CSS instead of returning HTML from this filter.
Source Code
This filter is located in src/Pdf/Maps/StaticMapRenderer.php of the PDF for GravityView extension.