Using Gravity Forms ‘gform_form_actions’ PHP action

The gform_form_actions Gravity Forms action allows you to add custom form actions that display below the form title in the Form List view.

Usage

add_action('gform_form_actions', 'your_custom_function', 10, 2);

Parameters

  • $actions (array): An associative array containing all the default form actions (Edit, Preview, Notifications, etc.).
  • $form_id (integer): The ID of the form for which the entry value was submitted.

More information

See Gravity Forms Docs: gform_form_actions

Examples

This example shows how to add a custom form action.

add_action('gform_form_actions', 'add_custom_link', 10, 2);
function add_custom_link($actions, $form_id) {
    $actions['custom_action'] = "<a href=\"" . get_admin_url() . "admin.php?page=custom_action&id={$form_id}\">Custom Action</a>";
    return $actions;
}

This example shows how to remove the default Preview action link.

add_action('gform_form_actions', 'remove_preview_link', 10, 2);
function remove_preview_link($actions, $form_id) {
    unset($actions['preview']);
    return $actions;
}

This example demonstrates how to remove the default Notifications action link.

add_action('gform_form_actions', 'remove_notifications_link', 10, 2);
function remove_notifications_link($actions, $form_id) {
    unset($actions['notifications']);
    return $actions;
}

This example shows how to change the text for the Edit action link.

add_action('gform_form_actions', 'change_edit_link_text', 10, 2);
function change_edit_link_text($actions, $form_id) {
    $actions['edit'] = str_replace('Edit', 'Modify', $actions['edit']);
    return $actions;
}

This example demonstrates how to change the color of the Delete action link.

add_action('gform_form_actions', 'change_delete_link_color', 10, 2);
function change_delete_link_color($actions, $form_id) {
    $actions['delete'] = str_replace('Delete', '<span style="color:red;">Delete</span>', $actions['delete']);
    return $actions;
}