Automattic\WooCommerce\Admin\Notes
Notes::trigger_note_action()
Trigger note action.
Метод класса: Notes{}
Возвращает
Note|true|false
.
Использование
$result = Notes::trigger_note_action( $note, $triggered_action );
- $note(Note) (обязательный)
- The note that has the triggered action.
- $triggered_action(объект) (обязательный)
- The triggered action.
Код Notes::trigger_note_action() Notes::trigger note action WC 9.2.3
public static function trigger_note_action( $note, $triggered_action ) { /** * Fires when an admin note action is taken. * * @param string $name The triggered action name. * @param Note $note The corresponding Note. */ do_action( 'woocommerce_note_action', $triggered_action->name, $note ); /** * Fires when an admin note action is taken. * For more specific targeting of note actions. * * @param Note $note The corresponding Note. */ do_action( 'woocommerce_note_action_' . $triggered_action->name, $note ); // Update the note with the status for this action. if ( ! empty( $triggered_action->status ) ) { $note->set_status( $triggered_action->status ); } $note->save(); $event_params = array( 'note_name' => $note->get_name(), 'note_type' => $note->get_type(), 'note_title' => $note->get_title(), 'note_content' => $note->get_content(), 'action_name' => $triggered_action->name, 'action_label' => $triggered_action->label, 'screen' => self::get_screen_name(), ); if ( in_array( $note->get_type(), array( 'error', 'update' ), true ) ) { wc_admin_record_tracks_event( 'store_alert_action', $event_params ); } else { self::record_tracks_event_without_cookies( 'inbox_action_click', $event_params ); } return $note; }