The gform_editor_sidebar_panels filter enables custom panels to be registered for display in the form editor sidebar.
Usage
To run the filter for all forms:
add_filter('gform_editor_sidebar_panels', 'your_function_name', 10, 2);
To target a specific form, add the form ID after the hook name:
add_filter('gform_editor_sidebar_panels_6', 'your_function_name', 10, 2);
Parameters
- $panels (array) – An array of custom sidebar panels.
- $form (Form Object) – The form currently being edited.
More information
See Gravity Forms Docs: gform_editor_sidebar_panels
Examples
Add a new panel
This example adds a new custom panel to the form editor sidebar.
add_filter('gform_editor_sidebar_panels', function ($panels, $form) { $panels[] = array( // Define the unique ID for your panel. 'id' => 'my_custom_panel_1', // Define the title to be displayed on the toggle button your panel. 'title' => 'My Custom Panel', // Define an array of classes to be added to the toggle button for your panel. 'nav_classes' => array('my_nav_class_1', 'my_nav_class_2'), // Define an array of classes to be added to the body of your panel. 'body_classes' => array('my_body_class_1'), ); return $panels; }, 10, 2);
Place this code in the functions.php file of your active theme or a custom functions plugin.
This filter was added in Gravity Forms v2.5. The filter is located in GFFormDetail::forms_page() in form_detail.php.