gform_editor_sidebar_panels

Description

The gform_editor_sidebar_panels filter enables custom panels to be registered for display in the form editor sidebar. Use the gform_editor_sidebar_panel_content action hook to echo the panel content.

Usage

The filter which would run for all forms would be used like so:

add_filter( 'gform_editor_sidebar_panels', 'your_function_name', 10, 2 );

You can also target a specific form by adding the form id after the hook name.

add_filter( 'gform_editor_sidebar_panels_6', 'your_function_name', 10, 2 );

Parameters

  • $panels arrayAn array of custom sidebar panels.
  • $form Form Object

    The form currently being edited.

Examples

1. Add a new panel

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 );

Placement

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GFFormDetail::forms_page() in form_detail.php