27 $this->label = esc_html__(
'Total',
'gk-gravityview' );
29 add_action(
'gravityview/edit_entry/after_update', array( $this,
'edit_entry_recalculate_totals' ), 10, 3 );
31 add_filter(
'gravityview_blocklist_field_types', array( $this,
'add_to_blocklist' ), 10, 2 );
33 parent::__construct();
57 if( empty( $context ) || $context !==
'edit' ) {
61 $blocklist[] =
'total';
79 $original_form = GFAPI::get_form(
$form[
'id'] );
81 $total_fields = GFCommon::get_fields_by_type( $original_form,
'total' );
84 if ( ! empty( $total_fields ) ) {
86 $entry = GFAPI::get_entry( $entry_id );
89 foreach ( $total_fields as $total_field ) {
90 $entry[
"{$total_field->id}"] = GFCommon::get_order_total( $original_form,
$entry );
93 $return_entry = GFAPI::update_entry(
$entry );
95 if( is_wp_error( $return_entry ) ) {
96 gravityview()->log->error(
'Updating the entry total fields failed', array(
'data' => $return_entry ) );
98 gravityview()->log->debug(
'Updating the entry total fields succeeded' );
Modify field settings by extending this class.
new GravityView_Field_Total
add_to_blocklist( $blocklist=array(), $context=NULL)
Prevent the Total fields from being displayed in the Edit Entry configuration screen – for now...
if(gravityview() ->plugin->is_GF_25()) $form
edit_entry_recalculate_totals( $form=array(), $entry_id=0, $Edit_Entry_Render=null)
If entry has totals fields, recalculate them.
gravityview()
The main GravityView wrapper function.