Using Gravity Forms ‘gform_print_entry_content’ PHP action

The gform_print_entry_content action in Gravity Forms runs when entries are being displayed and allows a custom display to be used for the entry.

Usage

add_action('gform_print_entry_content', 'my_function', 10, 3);

Parameters

  • $form (Form Object): The current form.
  • $entry (Entry Object): The current entry.
  • $entry_ids (array): The IDs of the entries being displayed.

More information

See Gravity Forms Docs: gform_print_entry_content

This action was added in Gravity Forms version 1.9.14.16 and is located in print-entry.php.

Examples

Display default entry content

add_action('gform_print_entry_content', 'gform_default_entry_content', 10, 3);

function gform_default_entry_content($form, $entry, $entry_ids) {
    $page_break = rgget('page_break') ? 'print-page-break' : false;

    // Separate each entry inside a form element so radio buttons don't get treated as a single group across multiple entries.
    echo '<form>';

    GFEntryDetail::lead_detail_grid($form, $entry);

    echo '</form>';

    if (rgget('notes')) {
        $notes = GFFormsModel::get_lead_notes($entry['id']);
        if (!empty($notes)) {
            GFEntryDetail::notes_grid($notes, false);
        }
    }

    // Output entry divider/page break.
    if (array_search($entry['id'], $entry_ids) < count($entry_ids) - 1) {
        echo '<div class="print-hr ' . $page_break . '"></div>';
    }
}

Prevent the default content from being output and use custom entry content function

// Prevent the default content being output.
add_action('gform_print_entry_content', function () {
    remove_action('gform_print_entry_content', 'gform_default_entry_content', 10);
}, 1);

// Bind our custom entry content function.
add_action('gform_print_entry_content', 'my_print_entry_content', 10, 3);

function my_print_entry_content($form, $entry, $entry_ids) {
    GFEntryDetail::lead_detail_grid($form, $entry);
}