GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
GravityView_Field_Notes Class Reference

Add Entry Notes. More...

Inheritance diagram for GravityView_Field_Notes:
GravityView_Field

Public Member Functions

 __construct ()
 
 add_entry_default_field ( $entry_default_fields, $form, $zone)
 Add Entry Notes to the Add Field picker in Edit View. More...
 
 add_template_path ( $file_paths)
 Include this extension templates path. More...
 
 enqueue_scripts ()
 Enqueue, localize field scripts and styles. More...
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 
 maybe_add_note ()
 Verify permissions, check if $_POST is set and as expected. More...
 
 maybe_delete_notes ()
 Possibly delete notes, if request is proper. More...
 
 process_delete_notes ( $data)
 
 register_scripts ()
 Register scripts and styles used by the Notes field. More...
 
- Public Member Functions inherited from GravityView_Field
 __construct ()
 GravityView_Field constructor. More...
 
 _filter_gform_custom_merge_tags ( $custom_merge_tags=array(), $form_id=0, $fields=array(), $element_id='')
 Add custom merge tags to merge tag options. More...
 
 _filter_gform_replace_merge_tags ( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Match the merge tag in replacement text for the field. More...
 
 _filter_sortable_fields ( $not_sortable)
 Use field settings to modify whether a field is sortable. More...
 
 add_entry_meta ( $entry_meta)
 Add the custom entry meta key to make it searchable and sortable. More...
 
 add_field_support ( $key, &$field_options)
 
 add_sortable_field ( $fields)
 Add the field to the Filter & Sort available fields. More...
 
 as_array ()
 Returns the field as an array to be used in field pickers. More...
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 Tap in here to modify field options. More...
 
 replace_merge_tag ( $matches=array(), $text='', $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Run GravityView filters when using GFCommon::replace_variables() More...
 
 set_default_search_label ( $label='', $gf_field=null, $field=array())
 Allow setting a default search label for search fields based on the field type. More...
 

Static Public Member Functions

static display_note ( $note, $show_delete=false, $context=null)
 Generate HTML output for a single note. More...
 
static get_add_note_part ( $atts, $context=null)
 Get the Add Note form HTML. More...
 
static strings ( $key='')
 Get strings used by the Entry Notes field. More...
 

Data Fields

 $icon = 'dashicons-admin-comments'
 
 $name = 'notes'
 
- Data Fields inherited from GravityView_Field
 $_gf_field_class_name
 
 $contexts = array( 'single', 'multiple', 'edit', 'export' )
 
 $default_search_label
 
 $description
 
 $entry_meta_is_default_column = false
 
 $entry_meta_key = null
 
 $entry_meta_update_callback = null
 
 $group
 standard, advanced, post, pricing, meta, gravityview, or add-ons More...
 
 $icon = 'dashicons-admin-generic'
 
 $is_numeric
 boolean Is field content number-based? More...
 
 $is_searchable = true
 
 $is_sortable = true
 boolean Can the field be sorted in search? More...
 
 $label
 
 $name
 
 $search_operators
 

Static Public Attributes

static $file
 
static $path
 

Private Member Functions

 add_hooks ()
 Add AJAX hooks, [gv_note_add] shortcode, and template loading paths. More...
 
 add_note ( $entry, $data)
 Add a note. More...
 
 get_email_footer ( $email_footer='', $is_html=true, $email_data=array())
 Get the footer for Entry Note emails. More...
 
 maybe_send_entry_notes ( $note=false, $entry=array(), $data=array())
 If note has an email to send, and the user has the right caps, send it. More...
 
 process_add_note ( $data)
 

Static Private Member Functions

static get_note_email_fields ( $entry_slug='')
 Generate a HTML dropdown of email values based on email fields from the current form. More...
 
static get_note_emails_array ()
 Get array of emails addresses from the stored entry. More...
 

Private Attributes

 $doing_ajax = false
 

Additional Inherited Members

- Protected Member Functions inherited from GravityView_Field
 custom_merge_tags ( $form=array(), $fields=array())
 Add custom Merge Tags to Merge Tag options, if custom Merge Tags exist. More...
 
 is_choice_value_enabled ()
 Check whether the enableChoiceValue flag is set for a GF field. More...
 
- Protected Attributes inherited from GravityView_Field
 $_custom_merge_tag = false
 
 $_field_id = ''
 
 $_field_options = array()
 

Detailed Description

Add Entry Notes.

Since
1.17

Definition at line 17 of file class-gravityview-field-notes.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 45 of file class-gravityview-field-notes.php.

References add_hooks().

Member Function Documentation

◆ add_entry_default_field()

add_entry_default_field (   $entry_default_fields,
  $form,
  $zone 
)

Add Entry Notes to the Add Field picker in Edit View.

See also
GravityView_Admin_Views::get_entry_default_fields()
Since
1.17
Parameters
array$entry_default_fieldsFields configured to show in the picker
array$formGravity Forms form array
string$zoneCurrent context: directory, single, edit
Returns
array Fields array with notes added, if in Multiple Entries or Single Entry context

Definition at line 100 of file class-gravityview-field-notes.php.

◆ add_hooks()

add_hooks ( )
private

Add AJAX hooks, [gv_note_add] shortcode, and template loading paths.

Since
1.17
Returns
void

Definition at line 64 of file class-gravityview-field-notes.php.

Referenced by __construct().

◆ add_note()

add_note (   $entry,
  $data 
)
private

Add a note.

Since
1.17
See also
GravityView_Entry_Notes::add_note This method is mostly a wrapper
Parameters
array$entry
array$dataNote details array
Returns
int|WP_Error

Definition at line 549 of file class-gravityview-field-notes.php.

References $entry, and GravityView_Entry_Notes\add_note().

Referenced by process_add_note().

◆ add_template_path()

add_template_path (   $file_paths)

Include this extension templates path.

Since
1.17
Parameters
array$file_pathsList of template paths ordered
Returns
array File paths with ./ and ./partials/ paths added

Definition at line 357 of file class-gravityview-field-notes.php.

◆ display_note()

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

Generate HTML output for a single note.

Since
1.17
Parameters
object$noteNote object with id, user_id, date_created, value, note_type, user_name, user_email vars
bool$show_deleteWhether to show the bulk delete inputs
Since
2.0
Parameters
\GV\Template_Context$contextThe context.
Returns
string HTML
Runs Filter:
gravityview/field/notes/content Modify the note content before rendering in the template
Since
1.17
Parameters
array$note_contentArray of note content that will be replaced in template files
object$noteNote object with id, user_id, date_created, value, note_type, user_name, user_email vars
boolean$show_deleteTrue: Notes are editable. False: no editing notes.
Since
2.0
Parameters
\GV\Template_Context$contextThe context.

Definition at line 465 of file class-gravityview-field-notes.php.

References $output, $show_delete, $value, GravityView_View\getInstance(), gravityview_strip_whitespace(), and GVCommon\has_cap().

◆ enqueue_scripts()

enqueue_scripts ( )

Enqueue, localize field scripts and styles.

Since
1.17
Returns
void

Definition at line 134 of file class-gravityview-field-notes.php.

References $strings.

◆ field_options()

field_options (   $field_options,
  $template_id,
  $field_id,
  $context,
  $input_type,
  $form_id 
)

Definition at line 365 of file class-gravityview-field-notes.php.

◆ get_add_note_part()

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

Get the Add Note form HTML.

Since
1.17
2.0
Parameters
array$attsShortcode attributes for entry ID
\GV\Template_Context$contextThe 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

Definition at line 576 of file class-gravityview-field-notes.php.

References $entry, $entry_slug, $gravityview_view, $visibility_settings, GF_Entry\from_entry(), GravityView_View\getInstance(), gravityview(), gravityview_strip_whitespace(), and GVCommon\has_cap().

◆ get_email_footer()

get_email_footer (   $email_footer = '',
  $is_html = true,
  $email_data = array() 
)
private

Get the footer for Entry Note emails.

{url} is replaced by the URL of the page where the note form was embedded

Since
1.18
See also
GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer'
Parameters
string$email_footerThe message footer value
bool$is_htmlTrue: Email is being sent as HTML; False: sent as text
Returns
string If email footer is not empty, return the message with placeholders replaced with dynamic values

Definition at line 848 of file class-gravityview-field-notes.php.

References $content, $output, $url, and Utils\get().

Referenced by maybe_send_entry_notes().

◆ get_note_email_fields()

static get_note_email_fields (   $entry_slug = '')
staticprivate

Generate a HTML dropdown of email values based on email fields from the current form.

get_note_emails_array

Since
1.17
Parameters
int | string$entry_slugCurrent entry unique ID
Returns
string HTML output
Runs Filter:
gravityview/field/notes/custom-email Whether to include a Custom Email option for users to define a custom email to mail notes to
Since
1.17
Parameters
bool$include_customDefault: true

Definition at line 680 of file class-gravityview-field-notes.php.

References $entry_slug, $strings, gravityview(), and GVCommon\has_cap().

◆ get_note_emails_array()

static get_note_emails_array ( )
staticprivate

Get array of emails addresses from the stored entry.

Since
1.17
Returns
array Array of email addresses connected to the entry
Runs Filter:
gravityview/field/notes/emails Modify the dropdown values displayed in the "Also email note to" dropdown
Since
1.17
Parameters
array$note_emailsArray of email addresses connected to the entry
array$entryCurrent entry

Definition at line 641 of file class-gravityview-field-notes.php.

References $entry, $gravityview_view, and GravityView_View\getInstance().

◆ maybe_add_note()

maybe_add_note ( )

Verify permissions, check if $_POST is set and as expected.

If so, use process_add_note

Since
1.17
See also
process_add_note
Returns
void

Definition at line 168 of file class-gravityview-field-notes.php.

References $post, gravityview(), GVCommon\has_cap(), and process_add_note().

◆ maybe_delete_notes()

maybe_delete_notes ( )

Possibly delete notes, if request is proper.

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

Since
1.17
See also
process_delete_notes
Returns
void

Definition at line 282 of file class-gravityview-field-notes.php.

References $post, GVCommon\has_cap(), and process_delete_notes().

◆ maybe_send_entry_notes()

maybe_send_entry_notes (   $note = false,
  $entry = array(),
  $data = array() 
)
private

If note has an email to send, and the user has the right caps, send it.

Since
1.17
Parameters
false | object$noteIf note was created, object. Otherwise, false.
array$entryEntry data.
array$data$_POST data.
Returns
void Tap in to Gravity Forms' gform_after_email action if you want a return result from sending the email.

Documented in get_note_email_fields

See also
get_note_email_fields
Runs Filter:
gravityview/field/notes/email_content Modify the values passed when sending a note email
See also
GVCommon::send_email
Since
1.17
Parameters
array$email_settingsValues being passed to the GVCommon::send_email() method: 'from', 'to', 'bcc', 'reply_to', 'subject', 'message', 'from_name', 'message_format', 'entry', 'email_footer'
Runs Filter:
gravityview/field/notes/wpautop_email Should the message content have paragraphs added automatically, if using HTML message format
Since
1.18
Parameters
bool$wpautop_emailTrue: Apply wpautop() to the email message if using; False: Leave as entered (Default: true)
See also
https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms

Definition at line 745 of file class-gravityview-field-notes.php.

References $entry, GV\$form, get_email_footer(), gravityview(), GVCommon\has_cap(), and GVCommon\send_email().

Referenced by process_add_note().

◆ process_add_note()

process_add_note (   $data)
private

◆ process_delete_notes()

process_delete_notes (   $data)

◆ register_scripts()

register_scripts ( )

Register scripts and styles used by the Notes field.

Since
1.17
Returns
void

Definition at line 121 of file class-gravityview-field-notes.php.

References $file, $path, gravityview_css_url(), and GV_PLUGIN_VERSION.

◆ strings()

static strings (   $key = '')
static

Get strings used by the Entry Notes field.

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

Since
1.17
Parameters
string$keyIf 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.
Runs Filter:
gravityview/field/notes/strings Modify the text used in the Entry Notes field. Sanitized by esc_html after return.
Since
1.17
Parameters
array$stringsText in key => value pairs

Definition at line 411 of file class-gravityview-field-notes.php.

References $strings, and gv_map_deep().

Field Documentation

◆ $doing_ajax

$doing_ajax = false
private

Definition at line 35 of file class-gravityview-field-notes.php.

◆ $file

$file
static

Definition at line 23 of file class-gravityview-field-notes.php.

Referenced by register_scripts().

◆ $icon

$icon = 'dashicons-admin-comments'

Definition at line 43 of file class-gravityview-field-notes.php.

◆ $name

$name = 'notes'

Definition at line 41 of file class-gravityview-field-notes.php.

◆ $path

$path
static

Definition at line 29 of file class-gravityview-field-notes.php.

Referenced by register_scripts().


The documentation for this class was generated from the following file: