Description
The gform_addon_app_navigation_{$SHORT_SLUG} filter allows developers to add navigation menu items to a Gravity Forms add-on’s app menu. Replace {$SHORT_SLUG} with the add-on’s slug.
Usage
add_filter( 'gform_addon_app_navigation_{your_addon_slug}', 'your_function_name' );
Parameters
| Parameter | Type | Description |
|---|---|---|
$addon_menus | array | A modifiable array of admin add-on menus. Each menu item can include a name, label, permission, and callback. |
Examples
Add a menu item.
Add a navigation item with a page name, label, required capability, and callback. Replace your_addon_slug with the add-on slug.
add_filter( 'gform_addon_app_navigation_your_addon_slug', 'add_addon_navigation_item' );
function add_addon_navigation_item( $addon_menus ) {
$addon_menus[] = array(
'name' => 'contacts',
'label' => __( 'Contacts', 'your-text-domain' ),
'permission' => 'your_addon_view_contacts',
'callback' => 'render_contacts_page',
);
return $addon_menus;
}
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 create_app_menu() in includes/addon/class-gf-addon.php.