GravityView  2.17
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_action_labels ()
 Returns labels for the action links on Edit Entry. 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=null, $entry=null, $view=null, $request=null)
 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...
 
 prevent_update_unapproved_meta ( $value, $form, $entry)
 Done once from self::preset_approval_fields. 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...
 
 verify_nonce ()
 Is the current nonce valid for editing the entry? More...
 
 verify_user_can_edit_post ( $field_content='', $field=null, $value='', $lead_id=0, $form_id=0)
 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_paged_submitted
 
 $is_valid = NULL
 
 $post_id
 
 $show_next_button
 
 $show_previous_button
 
 $show_update_button
 
 $view
 
 $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 adminOnly field property. More...
 
 filter_conditional_logic ( $form)
 Remove the conditional logic rules from the form button and the form fields, if needed. More...
 
 form_prepare_for_save ()
 Set visibility to visible and convert field input key to string. 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...
 
 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...
 
 preset_approval_fields ()
 Leverage gravityview/approve_entries/update_unapproved_meta to prevent the missing/empty approval field to affect is_approved meta at all. More...
 
 print_scripts ()
 Force Gravity Forms to output scripts as if it were in the admin. More...
 
 process_save ( $gv_data)
 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 ( $view, $entry)
 When Edit entry view is requested, set up key class variables. More...
 
 unselect_default_values ( $form)
 Checkboxes and other checkbox-based controls should not display default checks in edit mode. 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 131 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

Maybe process feeds.

Since
develop

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

References $entry, and $field.

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 2436 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
$validation_results{ bool $is_valid array $form int $failed_validation_page The page number which has failed validation. }
Returns
array

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

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

◆ 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 1059 of file class-edit-entry-render.php.

References GravityView_Edit_Entry\$file, $view, View\by_id(), 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 968 of file class-edit-entry-render.php.

References $entry, $form, $output, $template, 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 adminOnly 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
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

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

References $field, $form, $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

Fields that are tied to a conditional logic field that is not present in the view have to still be displayed, if the condition is met.

See also
https://github.com/gravityview/GravityView/issues/840
Since
develop

This conditional field is not editable in this View. We need to remove the rule, but only if it matches.

Normalize the indices...

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 2217 of file class-edit-entry-render.php.

References $field, $form, GV\$i, $value, and gravityview().

Referenced by filter_modify_form_fields(), and form_prepare_for_save().

◆ 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 1384 of file class-edit-entry-render.php.

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

◆ 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 2490 of file class-edit-entry-render.php.

References $field, and $field_value.

◆ form_prepare_for_save()

form_prepare_for_save ( )
private

Set visibility to visible and convert field input key to string.

Returns
array $form

GF_Field $field

Remove the fields with calculation formulas before save to avoid conflicts with GF logic

Since
1.16.3

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

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

Referenced by process_save().

◆ get_action_labels()

get_action_labels ( )

Returns labels for the action links on Edit Entry.

Since
2.10.4
Returns
array cancel, submit, next, previous array keys with associated labels.
Runs Filter:
gravityview/edit_entry/button_labels Modify the cancel/submit buttons' labels
Since
1.16.3
Parameters
array$labelsDefault button labels associative array
array$formThe Gravity Forms form
array$entryThe Gravity Forms entry
int$view_idThe current View ID

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

References $labels.

◆ 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
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 1919 of file class-edit-entry-render.php.

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

Referenced by filter_modify_form_fields(), update_calculation_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 1896 of file class-edit-entry-render.php.

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

Referenced by custom_validation(), and gform_pre_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 1516 of file class-edit-entry-render.php.

References $field, $field_value, $input_id, 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 1607 of file class-edit-entry-render.php.

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

◆ init()

init (   $gv_data = null,
  $entry = null,
  $view = null,
  $request = null 
)

Load required files and trigger edit flow.

Run when the is_edit_entry returns true.

Parameters
\GravityView_View_Data$gv_dataGravityView Data object
\GV\Entry$entryThe Entry.
\GV\View$viewThe View.
\GV\Request$requestThe Request.
Since
develop Added $entry, $view, $request adhocs.
Returns
void

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

References $entry, $view, edit_entry_form(), GravityView_View_Data\getInstance(), gravityview(), print_scripts(), process_save(), setup_vars(), user_can_edit_entry(), and verify_nonce().

◆ is_edit_entry()

is_edit_entry ( )

Is the current page an Edit Entry page?

Returns
boolean

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

References gravityview(), 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 223 of file class-edit-entry-render.php.

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

◆ load()

load ( )

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

Definition at line 135 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 2306 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/features/paged-edit
Since
2.5
2.14 Added the $form argument
Parameters
bool$enable_paged_editShould paged editing be supported?
array$formThe current form connected to the entry being edited
Runs Filter:
gravityview/edit_entry/button_labels Modify the cancel/submit buttons' labels
Since
1.16.3
Parameters
array$labelsDefault button labels associative array
array$formThe Gravity Forms form
array$entryThe Gravity Forms entry
int$view_idThe current View ID
Runs Filter:
gravityview/edit_entry/page/success Modify the edit entry success message on pages
Since
develop
Parameters
string$entry_updated_messageExisting message
int$view_idView ID
array$entryGravity Forms entry array
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
Parameters
string | null$redirect_urlURL to return to after the update.
Since
2.14.6

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

References $back_link, $labels, $view, Utils\_POST(), View\by_id(), GravityView_API\directory_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 839 of file class-edit-entry-render.php.

References $entry, $field, $field_id, $form, $post_id, $value, fill_post_template(), gravityview(), GVCommon\has_cap(), 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 2049 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 630 of file class-edit-entry-render.php.

References is_edit_entry().

◆ preset_approval_fields()

preset_approval_fields ( )
private

Leverage gravityview/approve_entries/update_unapproved_meta to prevent the missing/empty approval field to affect is_approved meta at all.

Called before the Gravity Forms after_update triggers.

Since
2.5
Returns
void

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

References $field.

Referenced by process_save().

◆ 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 190 of file class-edit-entry-render.php.

References gravityview(), and 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 175 of file class-edit-entry-render.php.

References is_edit_entry().

◆ prevent_update_unapproved_meta()

prevent_update_unapproved_meta (   $value,
  $form,
  $entry 
)

Done once from self::preset_approval_fields.

Since
2.5
Returns
string UNAPPROVED unless something else is inside the entry.

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

References $entry, $value, and GravityView_Entry_Approval_Status\UNAPPROVED.

◆ print_scripts()

print_scripts ( )
private

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

Returns
void

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

References $gravityview_view, and GravityView_View\getInstance().

Referenced by init().

◆ process_save()

process_save (   $gv_data)
private

Process edit entry form save.

Parameters
GravityView_View_Data$gv_dataThe View data.

This step is needed to unset the adminOnly from form fields, to add the calculation fields

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

Runs Actions:
gravityview/edit_entry/before_update Perform an action before the entry has been updated using Edit Entry
Since
2.1
Parameters
array$formGravity Forms form array
string$entry_idNumeric ID of the entry that is being updated
GravityView_Edit_Entry_Render$thisThis object
GravityView_View_Data$gv_dataThe View data

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
Since
2.1 Added $gv_data parameter
Parameters
array$formGravity Forms form array
string$entry_idNumeric ID of the entry that was updated
GravityView_Edit_Entry_Render$thisThis object
GravityView_View_Data$gv_dataThe View data

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

References $form, after_update(), form_prepare_for_save(), gravityview(), maybe_update_post_fields(), preset_approval_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 565 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 Filter:
gravityview/edit_entry/button_labels Modify the cancel/submit buttons' labels
Since
1.16.3
Parameters
array$labelsDefault button labels associative array
array$formThe Gravity Forms form
array$entryThe Gravity Forms entry
int$view_idThe current View ID
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 1255 of file class-edit-entry-render.php.

References $form, and $labels.

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 1366 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, with $value as backup (it can be empty during edit form rendering)

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

References $entry, $field, $input_id, and $value.

◆ setup_vars()

setup_vars (   $view,
  $entry 
)
private

When Edit entry view is requested, set up key class variables.

Since
2.14.6 Added $view and $entry params
Parameters
\GV\View$viewThe View.
\GV\Entry$entryThe Entry.
Returns
void

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

References $entries, $entry, $gravityview_view, $post, $view, Utils\get(), GravityView_Edit_Entry\get_nonce_key(), and GravityView_View\getInstance().

Referenced by init().

◆ unselect_default_values()

unselect_default_values (   $form)
private

Checkboxes and other checkbox-based controls should not display default checks in edit mode.

https://github.com/gravityview/GravityView/1149

Since
2.1
Parameters
array$formGravity Forms array object
Returns
array $form, modified to default checkboxes, radios from showing up.

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

References $field, $field_id, $field_value, $form, $input_id, $value, and Utils\get().

Referenced by filter_modify_form_fields().

◆ 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 437 of file class-edit-entry-render.php.

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

Referenced by process_save().

◆ update_calculation_fields()

update_calculation_fields ( )
private

◆ 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 758 of file class-edit-entry-render.php.

References $ary, $entry, $field, $field_id, $form, $image_meta, $post_id, $value, Utils\get(), GRAVITYVIEW_DIR, 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 2331 of file class-edit-entry-render.php.

References GravityView_Edit_Entry\check_user_cap_edit_entry(), GVCommon\generate_notice(), GravityView_oEmbed\getInstance(), gravityview(), 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 2404 of file class-edit-entry-render.php.

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

◆ 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

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 1704 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 2457 of file class-edit-entry-render.php.

References is_edit_entry(), and is_edit_entry_submission().

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

◆ verify_user_can_edit_post()

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

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/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
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

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

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

Field Documentation

◆ $entry

$entry

◆ $fields_with_calculation

$fields_with_calculation = array()

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

◆ $form

$form

◆ $form_after_validation

$form_after_validation = null

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

Referenced by filter_modify_form_fields().

◆ $form_id

$form_id

◆ $is_paged_submitted

$is_paged_submitted

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

◆ $is_valid

$is_valid = NULL

Definition at line 117 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 60 of file class-edit-entry-render.php.

◆ $original_form

$original_form
staticprivate

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

◆ $post_id

$post_id

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

Referenced by maybe_update_post_fields(), and update_post_image().

◆ $show_next_button

$show_next_button

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

◆ $show_previous_button

$show_previous_button

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

◆ $show_update_button

$show_update_button

Definition at line 128 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

$view

◆ $view_id

$view_id

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