Description
Use this filter to add custom form actions which display below the form title in the Form List view.
Usage
add_filter( 'gform_form_actions', 'form_actions', 10, 2 );
Parameters
| Parameter | Type | Description |
|---|---|---|
$actions | array | An associative array containing all of the default form actions (ie Edit, Preview, Notifications, etc.). |
$form_id | integer | The ID of the field from which the entry value was submitted. |
The $actions array can contain the following default actions:
array(
'edit' => '<a href="" ... >Edit</a>',
'preview' => '<a href="" ... >Preview</a>',
'entries' => '<a href="" ... >Entries</a>',
'notifications' => '<a href="" ... >Notifications</a>',
'duplicate' => '<a href="" ... >Duplicate</a>',
'delete' => '<a href="" ... >Delete</a>'
);
Examples
Add custom action link
This example demonstrates how to add an custom form action.
add_action( 'gform_form_actions', 'add_mergedoc_link', 10, 4 );
function add_mergedoc_link( $actions, $form_id ) {
$actions['mergedoc_settings'] = "<a href='" . get_admin_url() . "admin.php?page=gf_mergedoc&id={$form_id}'>" . __( 'MergeDoc', 'gravityformsmergedoc' ) . "</a>";
return $actions;
}
Remove Duplicate action link
This example demonstrates how to remove the default Duplicate action link.
add_action( 'gform_form_actions', 'remove_duplicate_link', 10, 4 );
function remove_duplicate_link( $actions, $form_id ) {
// Remove Duplicate action link
unset ( $actions['duplicate'] );
return $actions;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in GFFormList::form_list_page() in form_list.php.