Description
Modify the links that are displayed in the Gravity Forms toolbar.
Usage
add_filter( 'gform_toolbar_menu', 'my_custom_function' );
Parameters
- $menu_items array
An array of menu items and their properties.
$form_id integer
The ID of the form for which the toolbar is being displayed.
Examples
This example demonstrates how you can add your own item to the Gravity Forms Toolbar which displays on the Form Editor, Form Settings, and Entries views.
add_filter( 'gform_toolbar_menu', 'my_custom_toolbar', 10, 2 );
function my_custom_toolbar( $menu_items, $form_id ) {
$menu_items['my_custom_link'] = array(
'label' => 'My Custom Link', // the text to display on the menu for this link
'title' => 'My Custom Link', // the text to be displayed in the title attribute for this link
'url' => self_admin_url( 'admin.php?page=my_custom_page&id=' . $form_id ), // the URL this link should point to
'menu_class' => 'gf_form_toolbar_custom_link', // optional, class to apply to menu list item (useful for providing a custom icon)
'link_class' => rgget( 'page' ) == 'my_custom_page' ? 'gf_toolbar_active' : '', // class to apply to link (useful for specifying an active style when this link is the current page)
'capabilities'=> array( 'gravityforms_edit_forms' ), // the capabilities the user should possess in order to access this page
'priority' => 500 // optional, use this to specify the order in which this menu item should appear; if no priority is provided, the menu item will be appended to end
);
return $menu_items;
}
Source Code
This filter is located in GFForms::top_toolbar() in gravityforms.php