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

Public Member Functions

 __construct (GravityView_Edit_Entry $loader)
 
 custom_validation ( $validation_results)
 Make validation work for Edit Entry. More...
 
 edit_entry_form ()
 Display the Edit Entry form. More...
 
 filter_modify_form_fields ( $form, $ajax=false, $field_values='')
 Modify the form fields that are shown when using GFFormDisplay::get_form() More...
 
 fix_multiselect_value_serialization ( $field_value, $field, $_this)
 Multiselect in GF 2.2 became a json_encoded value. More...
 
 get_entry ()
 TODO: This seems to be hacky... More...
 
 gform_pre_validation ( $form)
 Add field keys that Gravity Forms expects. More...
 
 init ( $gv_data)
 Load required files and trigger edit flow. More...
 
 is_edit_entry ()
 Is the current page an Edit Entry page? More...
 
 is_edit_entry_submission ()
 Is the current page an Edit Entry page? More...
 
 load ()
 
 manage_conditional_logic ( $has_conditional_logic, $form)
 Disable the Gravity Forms conditional logic script and features on the Edit Entry screen. More...
 
 modify_fileupload_settings ( $plupload_init, $form_id, $instance)
 Remove max_files validation (done on gravityforms.js) to avoid conflicts with GravityView Late validation done on self::custom_validation. More...
 
 prevent_maybe_process_form ()
 Because we're mimicking being a front-end Gravity Forms form while using a Gravity Forms backend form, we need to prevent them from saving twice. More...
 
 prevent_render_form ()
 Don't show any forms embedded on a page when GravityView is in Edit Entry mode. More...
 
 render_form_buttons ()
 Display the Update/Cancel/Delete buttons for the Edit Entry form. More...
 
 save_field_value ( $value='', $entry=array(), $field=null, $form=array(), $input_id='')
 Make sure the fileuploads are not overwritten if no such request was done. More...
 
 user_registration_validation ( $validation_results)
 Make validation work for User Registration feeds. More...
 
 verify_nonce ()
 Is the current nonce valid for editing the entry? More...
 
 verify_user_can_edit_post ( $field_content='', $field, $value, $lead_id=0, $form_id)
 When displaying a field, check if it's a Post Field, and if so, make sure the post exists and current user has edit rights. More...
 

Data Fields

 $entry
 
 $fields_with_calculation = array()
 
 $form
 
 $form_after_validation = null
 
 $form_id
 
 $is_valid = NULL
 
 $view_id
 

Static Public Attributes

static $nonce_key
 

Protected Attributes

 $loader
 

Private Member Functions

 after_update ()
 Perform actions normally performed after updating a lead. More...
 
 check_user_cap_edit_field ( $field)
 checks if user has permissions to edit a specific field More...
 
 fill_post_template ( $template, $form, $entry, $do_shortcode=false)
 Convert a field content template into prepared output. More...
 
 filter_admin_only_fields ( $fields=array(), $edit_fields=null, $form=array(), $view_id=0)
 Remove fields that shouldn't be visible based on the Gravity Forms visibility field property. More...
 
 filter_conditional_logic ( $form)
 Remove the conditional logic rules from the form button and the form fields, if needed. More...
 
 get_configured_edit_fields ( $form, $view_id)
 Get the Edit Entry fields as configured in the View. More...
 
 get_field_value ( $field)
 Modify the value for the current field input. More...
 
 is_field_json_encoded ( $field)
 Is the field stored in a JSON-encoded manner? More...
 
 maybe_print_message ()
 Display success or error message if the form has been submitted. More...
 
 maybe_update_post_fields ( $form)
 Loop through the fields being edited and if they include Post fields, update the Entry's post object. More...
 
 merge_field_properties ( $field, $field_setting)
 Override GF Form field properties with the ones defined on the View. More...
 
 print_scripts ()
 Force Gravity Forms to output scripts as if it were in the admin. More...
 
 process_save ()
 Process edit entry form save. More...
 
 process_save_process_files ( $form_id)
 Have GF handle file uploads. More...
 
 render_edit_form ()
 Display the Edit Entry form in the original Gravity Forms format. More...
 
 setup_vars ()
 When Edit entry view is requested setup the vars. More...
 
 unset_hidden_field_values ()
 Delete the value of fields hidden by conditional logic when the entry is edited. More...
 
 update_calculation_fields ()
 
 update_post_image ( $form, $field, $field_id, $value, $entry, $post_id)
 Handle updating the Post Image field. More...
 
 user_can_edit_entry ( $echo=false)
 Check if the user can edit the entry. More...
 
 user_can_edit_field ( $field, $echo=false)
 Check whether a field is editable by the current user, and optionally display an error message GravityView_Edit_Entry->check_user_cap_edit_field() Check user capabilities. More...
 
 validate ()
 Process validation for a edit entry submission. More...
 

Static Private Attributes

static $nonce_field = 'is_gv_edit_entry'
 
static $original_entry = array()
 
static $original_form
 
static $supports_save_and_continue = false
 

Detailed Description

Definition at line 16 of file class-edit-entry-render.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( GravityView_Edit_Entry  $loader)

Definition at line 102 of file class-edit-entry-render.php.

References $loader.

Member Function Documentation

◆ after_update()

after_update ( )
private

Perform actions normally performed after updating a lead.

Since
1.8
See also
GFEntryDetail::lead_detail_page()
Returns
void

Definition at line 857 of file class-edit-entry-render.php.

References $entry, $field, and GravityView_GFFormsModel\get_database_version().

Referenced by process_save().

◆ check_user_cap_edit_field()

check_user_cap_edit_field (   $field)
private

checks if user has permissions to edit a specific field

Needs to be used combined with GravityView_Edit_Entry::user_can_edit_field for maximum security!!

Parameters
[type]$field [description]
Returns
bool

Definition at line 2072 of file class-edit-entry-render.php.

References $field, and GVCommon\has_cap().

Referenced by user_can_edit_field().

◆ custom_validation()

custom_validation (   $validation_results)

Make validation work for Edit Entry.

Because we're calling the GFFormDisplay::validate() in an unusual way (as a front-end form pretending to be a back-end form), validate() doesn't know we can't edit post fields. This goes through all the fields and if they're an invalid post field, we set them as valid. If there are still issues, we'll return false.

Parameters
[type]$validation_results [description]
Returns
[type] [description]

Definition at line 1474 of file class-edit-entry-render.php.

References $entry, $field, $value, and get_entry().

◆ edit_entry_form()

edit_entry_form ( )

Display the Edit Entry form.

Returns
void

Fixes weird wpautop() issue

See also
https://github.com/katzwebservices/GravityView/issues/451
Runs Filter:
gravityview_edit_entry_title Modify the edit entry title
Parameters
string$edit_entry_titleModify the "Edit Entry" title
GravityView_Edit_Entry_Render$thisThis object

Definition at line 884 of file class-edit-entry-render.php.

References GravityView_Edit_Entry\$file, gravityview_ob_include(), gravityview_strip_whitespace(), maybe_print_message(), and render_edit_form().

Referenced by init().

◆ fill_post_template()

fill_post_template (   $template,
  $form,
  $entry,
  $do_shortcode = false 
)
private

Convert a field content template into prepared output.

GravityView_GFFormsModel::get_post_field_images()

Since
1.17
Parameters
string$templateThe content template for the field
array$formGravity Forms form
bool$do_shortcodeWhether to process shortcode inside content. In GF, only run on Custom Field and Post Content fields
Returns
string

Definition at line 827 of file class-edit-entry-render.php.

References $entry, $form, $output, GravityView_GFFormsModel\get_post_field_images(), and GRAVITYVIEW_DIR.

Referenced by maybe_update_post_fields().

◆ filter_admin_only_fields()

filter_admin_only_fields (   $fields = array(),
  $edit_fields = null,
  $form = array(),
  $view_id = 0 
)
private

Remove fields that shouldn't be visible based on the Gravity Forms visibility field property.

Since
1.9.1
Parameters
array|GF_Field[]$fields Gravity Forms form fields
array | null$edit_fieldsFields for the Edit Entry tab configured in the View Configuration
array$formGF Form array
int$view_idView ID
Returns
array Possibly modified form array
Runs Filter:
gravityview/edit_entry/use_gf_admin_only_setting When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. If the Edit Entry tab is configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
Since
1.9.1
1.22.6 Deprecated
Deprecated:
Use gravityview/edit_entry/use_gf_visibility_setting instead
Parameters
boolean$use_gf_adminonly_settingTrue: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
array$formGF Form array
int$view_idView ID
Runs Filter:
gravityview/edit_entry/use_gf_visibility_setting When Edit tab isn't configured, should the Gravity Forms "Visibility" field settings be used to control field display? Default: true If the Edit Entry tab is not configured, Administrative fields will not be shown to non-administrators. If the Edit Entry tab is configured, Administrative fields will be shown to non-administrators, using the configured GV permissions
Since
1.22.6
Parameters
boolean$use_gf_visibility_settingTrue: Hide field if set to Administrative in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
array$formGF Form array
int$view_idView ID
Runs Filter:
gravityview/edit_entry/make_all_fields_visible Set field visibility to "visible" for all fields
Since
1.22.6
Parameters
string$visibility'visible' by default. Default options are 'hidden', 'visible', and 'administrative'
GF_Field$fieldForm field being modified
int$view_idCurrent View ID

Definition at line 1767 of file class-edit-entry-render.php.

References $field, $field_id, $field_value, $form, $value, $view_id, and GVCommon\has_cap().

Referenced by get_configured_edit_fields().

◆ filter_conditional_logic()

filter_conditional_logic (   $form)
private

Remove the conditional logic rules from the form button and the form fields, if needed.

Since
1.9
Parameters
array$formGravity Forms form
Returns
array Modified form, if not using Conditional Logic
Runs Filter:
gravityview/edit_entry/conditional_logic Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
Since
1.9
Parameters
bool$use_conditional_logicTrue: Gravity Forms will show/hide fields just like in the original form; False: conditional logic will be disabled and fields will be shown based on configuration. Default: true
array$formGravity Forms form

Definition at line 1908 of file class-edit-entry-render.php.

References $field, and $form.

Referenced by filter_modify_form_fields().

◆ filter_modify_form_fields()

filter_modify_form_fields (   $form,
  $ajax = false,
  $field_values = '' 
)

Modify the form fields that are shown when using GFFormDisplay::get_form()

By default, all fields will be shown. We only want the Edit Tab configured fields to be shown.

Parameters
array$form
boolean$ajaxWhether in AJAX mode
array | string$field_valuesPassed parameters to the form
Since
1.9
Returns
array Modified form array

Definition at line 1056 of file class-edit-entry-render.php.

References $form, $form_after_validation, filter_conditional_logic(), and get_configured_edit_fields().

◆ fix_multiselect_value_serialization()

fix_multiselect_value_serialization (   $field_value,
  $field,
  $_this 
)

Multiselect in GF 2.2 became a json_encoded value.

Fix it.

As a hack for now we'll implode it back.

Definition at line 2127 of file class-edit-entry-render.php.

References $field, and $field_value.

◆ get_configured_edit_fields()

get_configured_edit_fields (   $form,
  $view_id 
)
private

Get the Edit Entry fields as configured in the View.

Since
1.8
Parameters
int$view_id
Returns
array Array of fields that are configured in the Edit tab in the Admin

GravityView_View_Data is deprecated.

Runs Filter:
gravityview/edit_entry/form_fields Modify the fields displayed in Edit Entry form
Since
1.17
Parameters
GF_Field[]$fields Gravity Forms form fields
array | null$edit_fieldsFields for the Edit Entry tab configured in the View Configuration
array$formGF Form array (fields key modified to have only fields configured to show in Edit Entry)
int$view_idView ID

Definition at line 1628 of file class-edit-entry-render.php.

References $field, $form, $view_id, View\by_id(), filter_admin_only_fields(), GravityView_View_Data\getInstance(), and merge_field_properties().

Referenced by filter_modify_form_fields(), and validate().

◆ get_entry()

get_entry ( )

TODO: This seems to be hacky...

we should remove it. Entry is set when updating the form using setup_vars()! Get the current entry and set it if it's not yet set.

Returns
array Gravity Forms entry array

Definition at line 1605 of file class-edit-entry-render.php.

References $entry, gravityview_get_entry(), and GravityView_frontend\is_single_entry().

Referenced by custom_validation(), gform_pre_validation(), and user_registration_validation().

◆ get_field_value()

get_field_value (   $field)
private

Modify the value for the current field input.

Parameters
GF_Field$field
Returns
array|mixed|string
Runs Filter:
gravityview/edit_entry/pre_populate/override Allow the pre-populated value to override saved value in Edit Entry form. By default, pre-populate mechanism only kicks on empty fields.
Parameters
booleanTrue: override saved values; False: don't override (default)
$fieldGF_Field object Gravity Forms field object
Since
1.13
Runs Filter:
gravityview/edit_entry/field_value Change the value of an Edit Entry field, if needed
Since
1.11
1.20 Added third param
Parameters
mixed$field_valuefield value used to populate the input
object$fieldGravity Forms field object ( Class GF_Field )
GravityView_Edit_Entry_Render$thisCurrent object
Runs Filter:
gravityview/edit_entry/field_value_{field_type} Change the value of an Edit Entry field for a specific field type
Since
1.17
1.20 Added third param
Parameters
mixed$field_valuefield value used to populate the input
GF_Field$fieldGravity Forms field object
GravityView_Edit_Entry_Render$thisCurrent object

Definition at line 1183 of file class-edit-entry-render.php.

References $field, $field_value, and gv_empty().

Referenced by verify_user_can_edit_post().

◆ gform_pre_validation()

gform_pre_validation (   $form)

Add field keys that Gravity Forms expects.

See also
GFFormDisplay::validate()
Parameters
array$formGF Form
Returns
array Modified GF Form

this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.

What we have to do is set the value so that it doesn't get overwritten as empty on save and appears immediately in the Edit Entry screen again.

Definition at line 1274 of file class-edit-entry-render.php.

References $entry, $field, $form, $form_id, $value, get_entry(), and verify_nonce().

◆ init()

init (   $gv_data)

Load required files and trigger edit flow.

Run when the is_edit_entry returns true.

Parameters
GravityView_View_Data$gv_dataGravityView Data object
Returns
void

Definition at line 220 of file class-edit-entry-render.php.

References edit_entry_form(), gravityview(), print_scripts(), process_save(), setup_vars(), and user_can_edit_entry().

◆ is_edit_entry()

is_edit_entry ( )

Is the current page an Edit Entry page?

Returns
boolean

Definition at line 176 of file class-edit-entry-render.php.

References is_edit_entry_submission(), and GravityView_frontend\is_single_entry().

Referenced by manage_conditional_logic(), modify_fileupload_settings(), prevent_render_form(), and verify_nonce().

◆ is_edit_entry_submission()

is_edit_entry_submission ( )

Is the current page an Edit Entry page?

Since
1.9
Returns
boolean

Definition at line 188 of file class-edit-entry-render.php.

Referenced by is_edit_entry(), prevent_maybe_process_form(), verify_nonce(), and verify_user_can_edit_post().

◆ is_field_json_encoded()

is_field_json_encoded (   $field)
private

Is the field stored in a JSON-encoded manner?

Parameters
GF_Field$field
Returns
bool True: stored in DB json_encode()'d; False: not encoded

Definition at line 796 of file class-edit-entry-render.php.

References $field.

Referenced by maybe_update_post_fields(), and unset_hidden_field_values().

◆ load()

load ( )

"GRAVITYVIEW_DIR" "../../../"

Definition at line 106 of file class-edit-entry-render.php.

References GRAVITYVIEW_DIR.

◆ manage_conditional_logic()

manage_conditional_logic (   $has_conditional_logic,
  $form 
)

Disable the Gravity Forms conditional logic script and features on the Edit Entry screen.

Since
1.9
Parameters
$has_conditional_logic
$form
Returns
mixed
See also
GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation

Definition at line 1942 of file class-edit-entry-render.php.

References $form, and is_edit_entry().

◆ maybe_print_message()

maybe_print_message ( )
private

Display success or error message if the form has been submitted.

GVCommon::generate_notice

Since
1.16.2.2
Returns
void
Runs Filter:
gravityview/edit_entry/success Modify the edit entry success message (including the anchor link)
Since
1.5.4
Parameters
string$entry_updated_messageExisting message
int$view_idView ID
array$entryGravity Forms entry array
string$back_linkURL to return to the original entry.
Since
1.6

Definition at line 950 of file class-edit-entry-render.php.

References $back_link, and GVCommon\generate_notice().

Referenced by edit_entry_form().

◆ maybe_update_post_fields()

maybe_update_post_fields (   $form)
private

Loop through the fields being edited and if they include Post fields, update the Entry's post object.

Parameters
array$formGravity Forms form
Returns
void

Definition at line 671 of file class-edit-entry-render.php.

References $entry, $field, $field_id, $form, $value, fill_post_template(), GVCommon\has_cap(), is_field_json_encoded(), and update_post_image().

Referenced by process_save().

◆ merge_field_properties()

merge_field_properties (   $field,
  $field_setting 
)
private

Override GF Form field properties with the ones defined on the View.

Parameters
GF_Field$fieldGF Form field object
array$field_settingGV field options
Since
1.5
Returns
array|GF_Field

Normalize page numbers - avoid conflicts with page validation

Since
1.6

Definition at line 1731 of file class-edit-entry-render.php.

References $field.

Referenced by get_configured_edit_fields().

◆ modify_fileupload_settings()

modify_fileupload_settings (   $plupload_init,
  $form_id,
  $instance 
)

Remove max_files validation (done on gravityforms.js) to avoid conflicts with GravityView Late validation done on self::custom_validation.

Parameters
$plupload_initarray Plupload settings
$form_id
$instance
Returns
mixed

Definition at line 475 of file class-edit-entry-render.php.

References $field, $form, and is_edit_entry().

◆ prevent_maybe_process_form()

prevent_maybe_process_form ( )

Because we're mimicking being a front-end Gravity Forms form while using a Gravity Forms backend form, we need to prevent them from saving twice.

Returns
void

Definition at line 160 of file class-edit-entry-render.php.

References is_edit_entry_submission().

◆ prevent_render_form()

prevent_render_form ( )

Don't show any forms embedded on a page when GravityView is in Edit Entry mode.

Adds a __return_empty_string filter on the Gravity Forms shortcode on the wp_head action And then removes it on the wp_footer action

Since
1.16.1
Returns
void

Definition at line 145 of file class-edit-entry-render.php.

References is_edit_entry().

◆ print_scripts()

print_scripts ( )
private

Force Gravity Forms to output scripts as if it were in the admin.

Returns
void

Definition at line 253 of file class-edit-entry-render.php.

References $gravityview_view, and GravityView_View\getInstance().

Referenced by init().

◆ process_save()

process_save ( )
private

Process edit entry form save.

This step is needed to fix field visibility, to add the calculation fields

to avoid the capability validation of the method save_lead for GF 1.9+

to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()

Since
1.17.2

Must be AFTER after_update()!

See also
https://github.com/gravityview/GravityView/issues/764
Runs Actions:
gravityview/edit_entry/after_update Perform an action after the entry has been updated using Edit Entry
Parameters
array$formGravity Forms form array
string$entry_idNumeric ID of the entry that was updated
GravityView_Edit_Entry_Render$thisThis object

Definition at line 268 of file class-edit-entry-render.php.

References $form, after_update(), maybe_update_post_fields(), process_save_process_files(), unset_hidden_field_values(), update_calculation_fields(), validate(), and verify_nonce().

Referenced by init().

◆ process_save_process_files()

process_save_process_files (   $form_id)
private

Have GF handle file uploads.

Copy of code from GFFormDisplay::process_form()

Parameters
int$form_id

Make sure the fileuploads are not overwritten if no such request was done.

Since
1.20.1

Definition at line 410 of file class-edit-entry-render.php.

References $form_id.

Referenced by process_save().

◆ render_edit_form()

render_edit_form ( )
private

Display the Edit Entry form in the original Gravity Forms format.

Since
1.9
Returns
void
Runs Actions:
gravityview/edit-entry/render/before Before rendering the Edit Entry form
Since
1.17
Parameters
GravityView_Edit_Entry_Render$this
Runs Actions:
gravityview/edit-entry/render/after After rendering the Edit Entry form
Since
1.17
Parameters
GravityView_Edit_Entry_Render$this

Definition at line 990 of file class-edit-entry-render.php.

Referenced by edit_entry_form().

◆ render_form_buttons()

render_form_buttons ( )

Display the Update/Cancel/Delete buttons for the Edit Entry form.

Since
1.8
Returns
string

Definition at line 1038 of file class-edit-entry-render.php.

References GravityView_Edit_Entry\$file, and gravityview_ob_include().

◆ save_field_value()

save_field_value (   $value = '',
  $entry = array(),
  $field = null,
  $form = array(),
  $input_id = '' 
)

Make sure the fileuploads are not overwritten if no such request was done.

TO ONLY BE USED INTERNALLY; DO NOT DEVELOP ON; MAY BE REMOVED AT ANY TIME.

Since
1.20.1
Parameters
string$valueField value
array$entryGF entry array
GF_Field_FileUpload$field
array$formGF form array
string$input_idID of the input being saved
Returns
string

No file is being uploaded.

So return the original upload

Definition at line 442 of file class-edit-entry-render.php.

References $entry, $field, and $value.

◆ setup_vars()

setup_vars ( )
private

When Edit entry view is requested setup the vars.

Definition at line 195 of file class-edit-entry-render.php.

References $entries, $gravityview_view, GravityView_Edit_Entry\get_nonce_key(), and GravityView_View\getInstance().

Referenced by init().

◆ unset_hidden_field_values()

unset_hidden_field_values ( )
private

Delete the value of fields hidden by conditional logic when the entry is edited.

GFFormsModel::update_lead_field_value()

Since
1.17.4
Returns
void
Runs Filter:
gravityview/edit_entry/unset_hidden_field_values Whether to delete values of fields hidden by conditional logic
Since
1.22.2
Parameters
bool$unset_hidden_field_valuesDefault: true
GravityView_Edit_Entry_Render$thisThis object

Definition at line 357 of file class-edit-entry-render.php.

References $field, $field_value, GravityView_GFFormsModel\get_database_version(), and is_field_json_encoded().

Referenced by process_save().

◆ update_calculation_fields()

update_calculation_fields ( )
private

Never void the labels.

Always recalcualte the final price.

Fetch the quantity form the request.

Definition at line 518 of file class-edit-entry-render.php.

References $entry, $field_id, $form, and $value.

Referenced by process_save().

◆ update_post_image()

update_post_image (   $form,
  $field,
  $field_id,
  $value,
  $entry,
  $post_id 
)
private

Handle updating the Post Image field.

Sets a new Featured Image if configured in Gravity Forms; otherwise uploads/updates media

Since
1.17

GFFormsModel::media_handle_upload set_post_thumbnail

Parameters
array$formGF Form array
GF_Field$fieldGF Field
string$field_idNumeric ID of the field
string$value
array$entryGF Entry currently being edited
int$post_idID of the Post being edited
Returns
mixed|string

todo: As soon as ::media_handle_upload becomes a public method, move this call to ::media_handle_upload and remove the hack from this class. Note: the method became public in GF 1.9.17.7, but we don't require that version yet.

Definition at line 591 of file class-edit-entry-render.php.

References $ary, $entry, $field, $field_id, $form, $image_meta, $value, and GravityView_GFFormsModel\media_handle_upload().

Referenced by maybe_update_post_fields().

◆ user_can_edit_entry()

user_can_edit_entry (   $echo = false)
private

Check if the user can edit the entry.

  • Is the nonce valid?
  • Does the user have the right caps for the entry
  • Is the entry in the trash?
Parameters
boolean$echoShow error messages in the form?
Returns
boolean True: can edit form. False: nope.
  1. Permalinks are turned off
  2. There are two entries embedded using oEmbed
  3. One of the entries has just been saved

If the Entry is embedded, there may be two entries on the same page. If that's the case, and one is being edited, the other should fail gracefully and not display an error.

Since
1.9

Definition at line 1967 of file class-edit-entry-render.php.

References GravityView_Edit_Entry\check_user_cap_edit_entry(), GVCommon\generate_notice(), GravityView_oEmbed\getInstance(), gravityview_get_link(), and verify_nonce().

Referenced by init().

◆ user_can_edit_field()

user_can_edit_field (   $field,
  $echo = false 
)
private

Check whether a field is editable by the current user, and optionally display an error message GravityView_Edit_Entry->check_user_cap_edit_field() Check user capabilities.

Parameters
array$fieldField or field settings array
boolean$echoWhether to show error message telling user they aren't allowed
Returns
boolean True: user can edit the current field; False: nope, they can't.

Definition at line 2040 of file class-edit-entry-render.php.

References $field, check_user_cap_edit_field(), and GVCommon\generate_notice().

◆ user_registration_validation()

user_registration_validation (   $validation_results)

Make validation work for User Registration feeds.

The default validation does a bit too much for our liking. Email, username validation should work. Called on the gform_validation filter.

Parameters
array$validation_resultsThe validation results.
Returns
array The modified validation results.

Definition at line 1427 of file class-edit-entry-render.php.

References $entry, $form, $value, and get_entry().

◆ validate()

validate ( )
private

Process validation for a edit entry submission.

Sets the is_valid object var

Returns
void

If using GF User Registration Add-on, remove the validation step, otherwise generates error when updating the entry GF User Registration Add-on version > 3.x has a different class name

Since
1.16.2

Add some custom validation either way. https://secure.helpscout.net/conversation/430858351/10957/?folderId=1210164

For some crazy reason, Gravity Forms doesn't validate Edit Entry form submissions. You can enter whatever you want! We try validating, and customize the results using self::custom_validation()

Definition at line 1375 of file class-edit-entry-render.php.

References get_configured_edit_fields().

Referenced by process_save().

◆ verify_nonce()

verify_nonce ( )

Is the current nonce valid for editing the entry?

Returns
boolean
Runs Filter:
gravityview/edit_entry/verify_nonce Override Edit Entry nonce validation. Return true to declare nonce valid.
Since
1.13
Parameters
int | boolean$validFalse if invalid; 1 or 2 when nonce was generated
string$nonce_fieldKey used when validating submissions. Default: is_gv_edit_entry

Definition at line 2094 of file class-edit-entry-render.php.

References is_edit_entry(), and is_edit_entry_submission().

Referenced by gform_pre_validation(), process_save(), and user_can_edit_entry().

◆ verify_user_can_edit_post()

verify_user_can_edit_post (   $field_content = '',
  $field,
  $value,
  $lead_id = 0,
  $form_id 
)

When displaying a field, check if it's a Post Field, and if so, make sure the post exists and current user has edit rights.

Since
1.16.2.2
Parameters
string$field_contentAlways empty. Returning not-empty overrides the input.
GF_Field$field
string | array$valueIf array, it's a field with multiple inputs. If string, single input.
int$lead_idLead ID. Always 0 for the gform_field_input filter.
int$form_idForm ID
Returns
string If error, the error message. If no error, blank string (modify_edit_field_input() runs next)
Runs Filter:
gravityview/edit_entry/unsupported_post_field_text Modify the message when someone isn't able to edit a post
Parameters
string$messageThe existing "You don't have permission..." text
Runs Filter:
gravityview/edit_entry/no_post_text Modify the message when someone is editing an entry attached to a post that no longer exists
Parameters
string$messageThe existing "This field is not editable; the post no longer exists." text

Definition at line 1090 of file class-edit-entry-render.php.

References $field, $field_value, $form_id, $gv_field, $value, GravityView_Fields\get_associated_field(), get_field_value(), and is_edit_entry_submission().

Field Documentation

◆ $entry

$entry

◆ $fields_with_calculation

$fields_with_calculation = array()

Definition at line 79 of file class-edit-entry-render.php.

◆ $form

$form

◆ $form_after_validation

$form_after_validation = null

Definition at line 73 of file class-edit-entry-render.php.

Referenced by filter_modify_form_fields().

◆ $form_id

$form_id

◆ $is_valid

$is_valid = NULL

Definition at line 100 of file class-edit-entry-render.php.

◆ $loader

$loader
protected

Definition at line 21 of file class-edit-entry-render.php.

Referenced by __construct().

◆ $nonce_field

$nonce_field = 'is_gv_edit_entry'
staticprivate

Definition at line 32 of file class-edit-entry-render.php.

◆ $nonce_key

$nonce_key
static

Definition at line 26 of file class-edit-entry-render.php.

◆ $original_entry

$original_entry = array()
staticprivate

Definition at line 52 of file class-edit-entry-render.php.

◆ $original_form

$original_form
staticprivate

Definition at line 66 of file class-edit-entry-render.php.

◆ $supports_save_and_continue

$supports_save_and_continue = false
staticprivate

Definition at line 38 of file class-edit-entry-render.php.

◆ $view_id

$view_id

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