Adding a Note to the Entry when Using the Add-On Framework

Introduction

There are times when using the Add-On Framework you may want to add a note to the entry. There are two methods available, add_note() and add_feed_error().

add_note()

Adds a note to the entry.

Any add-on which extends GFAddon, GFFeedAddOn, or GFPaymentAddOn can use add_note().

Note: Prior to Gravity Forms 1.9.12, this was only available to add-ons which extended GFPaymentAddOn().
$this->add_note( $entry['id'], 'Mailing list subscription failed.', 'error' );

Parameters

  • $entry_id integer

    The ID of the entry the note should be added to.

  • $note string

    The note to be added to the entry.

  • $note_type string|null

    Default is null. When a note type is specified it is appended to the class attribute of the div element which contains the note as gforms_note_{$note_type}. There are two built-in class names: gforms_note_error and gforms_note_success.

add_feed_error()

Adds an error type note to the entry and writes an error to the add-on log.

Any add-on which extends GFFeedAddOn or GFPaymentAddOn can use add_feed_error().

Note: This function was added in Gravity Forms 1.9.12.
$this->add_feed_error( 'Mailing list subscription failed.', $feed, $entry, $form );

Parameters

  • $error_message string

    The note to be added to the entry and logged to the add-on log when the Logging Add-On is enabled.

  • $feed Feed Object

    The feed currently being processed.

  • $entry Entry Object

    The entry currently being processed.

  • $form Form Object

    The form currently being processed.

note_avatar()

Override this function to specify the url for a custom avatar which will be used for notes added by your add-on.

In this example we are using a file named img_48x48.png which is stored in the add-ons images directory.

public function note_avatar() {

    return $this->get_base_url() . "/images/img_48x48.png";
}