Skip to content

Commit bb89be6

Browse files
committed
Adds entry is updated notification
1 parent cb40aa2 commit bb89be6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

includes/extensions/edit-entry/class-edit-entry.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ private function add_hooks() {
9595
add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
9696

9797
add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
98+
99+
add_filter( 'gform_notification_events', array( $this, 'add_edit_notification_events' ), 10, 2 );
100+
101+
add_action( 'gravityview/edit_entry/after_update', array( $this, 'trigger_notifications' ), 10, 3 );
102+
98103
}
99104

100105
/**
@@ -455,6 +460,34 @@ function ( $caps ) {
455460

456461
GFForms::delete_file();
457462
}
463+
464+
/**
465+
* Trigger the notifications.
466+
*
467+
* @since TBD
468+
*
469+
* @param array $form The form object.
470+
* @param int $entry_id The entry ID.
471+
*/
472+
public function trigger_notifications( $form, $entry_id, $edit_entry_render ) {
473+
GravityView_Notifications::send_notifications( (int) $entry_id, 'gravityview/edit_entry/after_update', $edit_entry_render->entry );
474+
}
475+
476+
/**
477+
* Add the edit notification event.
478+
*
479+
* @since TBD
480+
*
481+
* @param array $notification_events Existing notification events.
482+
* @param array $form The form object.
483+
*
484+
* @return array
485+
*/
486+
public function add_edit_notification_events( $notification_events = array(), $form = array() ) {
487+
$notification_events['gravityview/edit_entry/after_update'] = 'GravityView - ' . esc_html_x( 'Entry is updated', 'The title for an event in a notifications drop down list.', 'gk-gravityview' );
488+
return $notification_events;
489+
}
490+
458491
} // end class
459492

460493
// add_action( 'plugins_loaded', array('GravityView_Edit_Entry', 'getInstance'), 6 );

0 commit comments

Comments
 (0)