gform_form_trash_link

gform_form_trash_link

DescriptionUsageParametersExamples1. Change the text of the link2. Prevent a specific Form from being deletedPlacementSinceSource Code

Description

This filter is no longer available since Gravity Forms 2.5.

Allows for modification of the Form Trash Link on the Form Editor page.

Note: Replaced the deprecated gform_form_delete_link filter.

Usage

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

Parameters

$trash_link stringThe Trash link HTML.$form_id intThe ID of the form being edited.

Examples

1. Change the text of the link

add_filter( 'gform_form_trash_link', 'rename_trash_link', 10, 2 );function rename_trash_link( $trash_link, $form_id ){    $trash_link = str_replace( 'Move to Trash', 'Remove this Form', $trash_link );    return $trash_link;}

2. Prevent a specific Form from being deleted

add_filter( 'gform_form_trash_link', 'prevent_form_deletion', 10, 2 );function prevent_form_deletion( $trash_link, $form_id ){    if ( $form_id == 75 ) {        $trash_link = 'Remove this Form';    }    return $trash_link;}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.8.Added the $form_id param in version 2.1.2.3.

Source Code

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

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注