Description
Add custom pages (i.e. “views”) to the Import/Export section.
Usage
Specify the view name after the gform_export_page_ hook name:
add_action( 'gform_export_page_my_custom_page', 'my_custom_function' );
Parameters
There are no parameters for this action.
Examples
This example demonstrates how to display the content for your custom page and also how to add a menu item to link to this custom page on the Import/Export section via the gform_export_menu filter.
// Let's add our menu item first with the 'gform_export_menu' filter
add_filter( 'gform_export_menu', 'my_custom_export_menu_item' );
function my_custom_export_menu_item( $menu_items ) {
$menu_items[] = array(
'name' => 'my_custom_export_page',
'label' => __( 'My Custom Export Page' ),
);
return $menu_items;
}
// Now let's display the content of our custom page
add_action( 'gform_export_page_my_custom_export_page', 'my_custom_export_page' );
function my_custom_export_page() {
GFExport::page_header();
echo 'My Custom Export Page Settings!';
GFExport::page_footer();
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in GFExport::export_page() in export.php.