Gform form actions

(Created page with "__NOTOC__ == Description == Use this filter to add custom form actions which display below the form title in the Form List view. == Usage == <pre class="brush:php"> <?php add_...")
(Examples)
Line 35: Line 35:
<pre class="brush:php">
<pre class="brush:php">
<?php
<?php
-
add_action('gform_entries_first_column_actions', 'first_column_actions', 10, 4);
+
add_action('gform_form_actions', 'add_mergedoc_link', 10, 4);
function add_mergedoc_link($actions, $form_id) {
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>";
         $actions['mergedoc_settings'] = "<a href=\"" . get_admin_url() . "admin.php?page=gf_mergedoc&id={$form_id}\">" . __("MergeDoc", "gravityformsmergedoc") . "</a>";

Revision as of 21:26, 22 November 2011

Description

Use this filter to add custom form actions which display below the form title in the Form List view.

Usage

<?php
add_filter("gform_form_actions", "form_actions", 10, 2);
?>

Parameters

$actions
(array) An associative array containing all of the default form actions (ie Edit, Preview, Notifications, etc.).
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>'
);
$form_id
(integer) The ID of the field from which the entry value was submitted.

Examples

This example demonstrates how to add an custom form action.

<?php
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;
    }
?>

Source Code

This filter is located in form_list.php

Search the Documentation