GravityView_Edit_Entry_Render
Source: includes/extensions/edit-entry/class-edit-entry-render.php:18
Details
- Kind:
class - Namespace:
(global)
Properties
| Property | Type | Description |
|---|---|---|
$loader | GravityView_Edit_Entry | |
$entry | array | Gravity Forms entry array |
$view | \GV\View. | The View. |
$form | array | Gravity Forms form array (GravityView modifies the content through this class lifecycle) |
$form_after_validation | array | Gravity Forms form array after the form validation process |
$fields_with_calculation | array | Hold an array of GF field objects that have calculation rules |
$form_id | int | Gravity Forms form id |
$view_id | int | ID of the current view |
$post_id | int | ID of the current post. May also be ID of the current View. |
$is_valid | array | Updated entry is valid (GF Validation object) |
$show_previous_button | bool | Internal page button states. |
Methods
| Method | Description |
|---|---|
prevent_render_form() | Don't show any forms embedded on a page when GravityView is in Edit Entry mode |
prevent_maybe_process_form() | Because we're mimicking being a front-end Gravity Forms form while using a Gravity Forms |
is_edit_entry() | Is the current page an Edit Entry page? |
is_edit_entry_submission() | Is the current page an Edit Entry page? |
init() | Load required files and trigger edit flow |
prevent_update_unapproved_meta() | Done once from self::preset_approval_fields |
save_field_value() | Make sure the fileuploads are not overwritten if no such request was done. |
edit_entry_form() | Display the Edit Entry form |
render_form_buttons() | Display the Update/Cancel/Delete buttons for the Edit Entry form |
filter_modify_form_fields() | Modify the form fields that are shown when using GFFormDisplay::get_form() |
verify_user_can_edit_post() | 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. |
modify_edit_field_input() | Fill-in the saved values into the form inputs |
gform_pre_validation() | Add field keys that Gravity Forms expects. |
custom_validation() | Make validation work for Edit Entry |
get_entry() | TODO: This seems to be hacky... we should remove it. Entry is set when updating the form using setup_vars()! |
merge_field_properties() | Override GF Form field properties with the ones defined on the View |
set_default_values() | Conditional logic isn't designed to work with forms that already have content. When switching input values, |
manage_conditional_logic() | Disable the Gravity Forms conditional logic script and features on the Edit Entry screen |
verify_nonce() | Is the current nonce valid for editing the entry? |
get_action_labels() | Returns labels for the action links on Edit Entry |
fake_existing_file_uploads() | Returns an upload result for existing temporary uploaded files. |
Method Reference
prevent_render_form()
public function 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
Returns
void
Since: 1.16.1
Source: includes/extensions/edit-entry/class-edit-entry-render.php:201
prevent_maybe_process_form()
public function 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
Source: includes/extensions/edit-entry/class-edit-entry-render.php:217
is_edit_entry()
public function is_edit_entry()
Is the current page an Edit Entry page?
Returns
boolean
Source: includes/extensions/edit-entry/class-edit-entry-render.php:237
is_edit_entry_submission()
public function is_edit_entry_submission()
Is the current page an Edit Entry page?
Returns
boolean
Since: 1.9
Source: includes/extensions/edit-entry/class-edit-entry-render.php:252
init()
public function 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
| Name | Type | Default | Description |
|---|---|---|---|
$gv_data | \GravityView_View_Data | null | GravityView Data object |
$entry | \GV\Entry | null | The Entry. |
$view | \GV\View | null | The View. |
$request | \GV\Request | null | The Request. |
Returns
void
Since: develop Added $entry, $view, $request adhocs.
Source: includes/extensions/edit-entry/class-edit-entry-render.php:330
prevent_update_unapproved_meta()
public function prevent_update_unapproved_meta( $value, $form, $entry )
Done once from self::preset_approval_fields
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | |||
$form | |||
$entry |
Returns
string— UNAPPROVED unless something else is inside the entry.
Since: 2.5
Source: includes/extensions/edit-entry/class-edit-entry-render.php:693
save_field_value()
public function save_field_value( $value='', $entry=[], $field=null, $form=[], $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.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | '' | Field value |
$entry | array | [] | GF entry array |
$field | GF_Field_FileUpload | null | |
$form | array | [] | GF form array |
$input_id | string | '' | ID of the input being saved |
Returns
string
Since: 1.20.1
Source: includes/extensions/edit-entry/class-edit-entry-render.php:747
edit_entry_form()
public function edit_entry_form()
Display the Edit Entry form
Returns
void
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1226
render_form_buttons()
public function render_form_buttons()
Display the Update/Cancel/Delete buttons for the Edit Entry form
Returns
string
Since: 1.8
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1573
filter_modify_form_fields()
public function 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
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | ||
$ajax | boolean | false | Whether in AJAX mode |
$field_values | array | string | '' | Passed parameters to the form |
Returns
array— Modified form array
Since: 1.9
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1591
verify_user_can_edit_post()
public function 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.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_content | string | '' | Always empty. Returning not-empty overrides the input. |
$field | GF_Field | null | |
$value | string | array | '' | If array, it's a field with multiple inputs. If string, single input. |
$lead_id | int | 0 | Lead ID. Always 0 for the gform_field_input filter. |
$form_id | int | 0 | Form ID |
Returns
string— If error, the error message. If no error, blank string (modify_edit_field_input() runs next)
Since: 1.16.2.2
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1629
modify_edit_field_input()
public function modify_edit_field_input( $field_content='', $field=null, $value='', $lead_id=0, $form_id=0 )
Fill-in the saved values into the form inputs
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_content | string | '' | Always empty. Returning not-empty overrides the input. |
$field | GF_Field | null | |
$value | string | array | '' | If array, it's a field with multiple inputs. If string, single input. |
$lead_id | int | 0 | Lead ID. Always 0 for the gform_field_input filter. |
$form_id | int | 0 | Form ID |
Returns
mixed
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1673
gform_pre_validation()
public function gform_pre_validation( $form )
Add field keys that Gravity Forms expects.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | GF Form |
Returns
array— Modified GF Form
See Also
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1829
custom_validation()
public function 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
| Name | Type | Default | Description |
|---|---|---|---|
$validation_results | { |
Returns
array
Source: includes/extensions/edit-entry/class-edit-entry-render.php:1996
get_entry()
public function 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
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2141
merge_field_properties()
public static function merge_field_properties( $field, $field_setting )
Override GF Form field properties with the ones defined on the View
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | GF_Field | GF Form field object | |
$field_setting | array | GV field options |
Returns
array| GF_Field
Since: 1.5
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2293
set_default_values()
public function set_default_values( bool $has_conditional_logic, ?array $form=null ): bool
Conditional logic isn't designed to work with forms that already have content. When switching input values,
the dependent fields will be blank.
We update the defaultValue of all the fields, just before the JavaScript is rendered, in order for the
defaults key on the Conditional Logic configuration to be populated properly with the stored values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$has_conditional_logic | bool | Whether the form has conditional logic | |
$form | array | null | null | The forb object. |
Returns
bool
Since: 2.48.2
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2406
manage_conditional_logic()
public function manage_conditional_logic( $has_conditional_logic, $form )
Disable the Gravity Forms conditional logic script and features on the Edit Entry screen
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$has_conditional_logic | |||
$form |
Returns
mixed
Since: 1.9
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2593
verify_nonce()
public function verify_nonce()
Is the current nonce valid for editing the entry?
Returns
boolean
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2756
get_action_labels()
public function get_action_labels()
Returns labels for the action links on Edit Entry
Returns
array—cancel,submit,next,previousarray keys with associated labels.
Since: 2.10.4
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2789
fake_existing_file_uploads()
public function fake_existing_file_uploads( $field, $form )
Returns an upload result for existing temporary uploaded files.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | The field object. | |
$form | array | The Form object. |
Since: 2.40
Source: includes/extensions/edit-entry/class-edit-entry-render.php:2876