Skip to main content

GravityView_Field_Notes

Add Entry Notes

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:18

Details

  • Kind: class
  • Namespace: (global)
  • Extends: GravityView_Field

Properties

PropertyTypeDescription
$filestringCurrent FILE
$pathstringplugin_dir_path() of the current field file
$namestringThe name of the GravityView field type
$iconstringIcon class for the field.

Methods

MethodDescription
__construct()Constructor.
add_entry_default_field()Add Entry Notes to the Add Field picker in Edit View
register_scripts()Registers scripts and styles used in the UI.
enqueue_scripts()Enqueues and localizes scripts and styles.
maybe_add_note()Verify permissions, check if $_POST is set and as expected. If so, use process_add_note.
maybe_delete_notes()Possibly delete notes, if request is proper.
process_delete_notes()Handle deleting notes.
add_template_path()Include this extension templates path.
strings()Get strings used by the Entry Notes field.
display_note()Generate HTML output for a single note.
get_add_note_part()Get the Add Note form HTML.

Method Reference

__construct()

public function __construct()

Constructor.

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:52

add_entry_default_field()

public function add_entry_default_field( $entry_default_fields, $form, $zone )

Add Entry Notes to the Add Field picker in Edit View

Parameters

NameTypeDefaultDescription
$entry_default_fieldsarrayFields configured to show in the picker
$formarrayGravity Forms form array
$zonestringCurrent context: directory, single, edit

Returns

  • array — Fields array with notes added, if in Multiple Entries or Single Entry context

See Also

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:106

register_scripts()

public function register_scripts()

Registers scripts and styles used in the UI.

Returns

  • void

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:127

enqueue_scripts()

public function enqueue_scripts()

Enqueues and localizes scripts and styles.

Returns

  • void

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:141

maybe_add_note()

public function maybe_add_note()

Verify permissions, check if $_POST is set and as expected. If so, use process_add_note.

Returns

  • void

See Also

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:180

maybe_delete_notes()

public function maybe_delete_notes()

Possibly delete notes, if request is proper.

Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes.

Returns

  • void

See Also

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:404

process_delete_notes()

public function process_delete_notes( $data )

Handle deleting notes.

Parameters

NameTypeDefaultDescription
$dataarray{ Array of deletion data.

Returns

  • void

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:454

add_template_path()

public function add_template_path( $file_paths )

Include this extension templates path.

Parameters

NameTypeDefaultDescription
$file_pathsarrayList of template paths ordered.

Returns

  • array — File paths with ./ and ./partials/ paths added.

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:490

strings()

public static function strings( $key='' )

Get strings used by the Entry Notes field.

Use gravityview/field/notes/strings filter to modify the strings.

Parameters

NameTypeDefaultDescription
$keystring''If set, return the string with the key of $key.

Returns

  • array | string — Array of strings with keys and values. If $key is set, returns string. If missing $strings[ $key ], empty string.

Since: 1.17

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:548

display_note()

public static function display_note( $note, $show_delete=false, $context=null )

Generate HTML output for a single note.

Parameters

NameTypeDefaultDescription
$noteobjectNote object with id, user_id, date_created, value, note_type, user_name, user_email vars.
$show_deleteboolfalseWhether to show the bulk delete inputs.
$context\GV\Template_ContextnullThe context.

Returns

  • string — HTML.

Since:

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:604

get_add_note_part()

public static function get_add_note_part( $atts, $context=null )

Get the Add Note form HTML.

Parameters

NameTypeDefaultDescription
$attsarrayShortcode attributes for entry ID.
$context\GV\Template_ContextnullThe context, when called outside of a shortcode.

Returns

  • string — HTML of the Add Note form, or empty string if the user doesn't have the gravityview_add_entry_notes cap.

Since:

Source: includes/extensions/entry-notes/class-gravityview-field-notes.php:719