Automattic\WooCommerce\Internal\Admin

Events::get_note_from_db()publicWC 1.0

Get note.

{} It's a method of the class: Events{}

No Hooks.

Return

null. Nothing.

Usage

$Events = new Events();
$Events->get_note_from_db( $note_from_db );
$note_from_db(Note) (required)
The note object from the database.

Code of Events::get_note_from_db() WC 7.1.0

public function get_note_from_db( $note_from_db ) {
	if ( ! $note_from_db instanceof Note || get_user_locale() === $note_from_db->get_locale() ) {
		return $note_from_db;
	}

	$note_classes = array_merge( self::$note_classes_to_added_or_updated, self::$other_note_classes );
	foreach ( $note_classes as $note_class ) {
		if ( defined( "$note_class::NOTE_NAME" ) && $note_class::NOTE_NAME === $note_from_db->get_name() ) {
			$note_from_class = method_exists( $note_class, 'get_note' ) ? $note_class::get_note() : null;

			if ( $note_from_class instanceof Note ) {
				$note = clone $note_from_db;
				$note->set_title( $note_from_class->get_title() );
				$note->set_content( $note_from_class->get_content() );
				$note->set_actions( $note_from_class->get_actions() );
				return $note;
			}
			break;
		}
	}
	return $note_from_db;
}