Using Gravity Forms ‘gform_settings_SUBVIEW’ PHP action

The gform_settings_SUBVIEW action is triggered within the Gravity Forms settings page, depending on the specific subview you are viewing. The SUBVIEW is replaced with the subview that the action should be fired on.

Usage

add_action('gform_settings_gravityformswebapi', 'my_function', 10, 1);

Parameters

  • $subview (string): The subview of the settings page that the action is being triggered on.

More information

See Gravity Forms Docs: gform_settings_SUBVIEW

This action hook is located in settings.php.

Examples

Adding custom content to Web API settings page

This code adds custom content to the Web API settings page.

function my_custom_api_settings_content() {
  echo '<h3>Custom Content</h3>';
  echo '<p>Add your custom content here.</p>';
}
add_action('gform_settings_gravityformswebapi', 'my_custom_api_settings_content', 10, 1);

Displaying a notice on a specific settings subview

This code displays a custom notice on the Add-Ons settings subview.

function my_custom_addons_notice() {
  echo '<div class="notice notice-warning">This is a custom notice for Add-Ons settings subview.</div>';
}
add_action('gform_settings_addons', 'my_custom_addons_notice', 10, 1);

Enqueueing a custom JavaScript file for a specific settings subview

This code enqueues a custom JavaScript file on the “Custom Settings” subview.

function my_enqueue_custom_settings_js() {
  wp_enqueue_script('custom-settings-js', get_stylesheet_directory_uri() . '/js/custom-settings.js', array('jquery'), '1.0', true);
}
add_action('gform_settings_customsettings', 'my_enqueue_custom_settings_js', 10, 1);

Displaying a message on the settings subview based on a query parameter

This code displays a message on the “System Status” settings subview if a specific query parameter is present in the URL.

function my_system_status_message() {
  if (isset($_GET['my_param']) && $_GET['my_param'] == '1') {
    echo '<div class="notice notice-success">Custom message for System Status subview.</div>';
  }
}
add_action('gform_settings_systemstatus', 'my_system_status_message', 10, 1);

Adding custom CSS for a specific settings subview

This code adds custom CSS on the “Forms” settings subview.

function my_custom_forms_settings_css() {
  echo '<style>
    .gform-settings-page #main-container {
      background-color: #f8f8f8;
    }
  </style>';
}
add_action('gform_settings_forms', 'my_custom_forms_settings_css', 10, 1);