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.
add_template_path()Include this extension templates path.
render_exclude_note_types()Renders the exclude note types multiselect inside the notes checkboxes fieldset.
filter_notes_by_type()Filters notes by excluding specified note types.
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:107

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:128

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:142

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:181

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:405

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:491

render_exclude_note_types()

public function render_exclude_note_types( $field_type )

Renders the exclude note types multiselect inside the notes checkboxes fieldset.

Parameters

NameTypeDefaultDescription
$field_typeGravityView_FieldTypeThe field type instance.

Returns

  • void

Since: 2.53.0

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

filter_notes_by_type()

public static function filter_notes_by_type( $notes, $exclude_note_types )

Filters notes by excluding specified note types.

Parameters

NameTypeDefaultDescription
$notesarrayArray of note objects.
$exclude_note_typesarrayArray of note types to exclude. Accepts multiselect format ['type1', 'type2'].

Returns

  • array — Filtered array of note objects.

Since: 2.53.0

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

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:725

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:781

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:896