Automattic\WooCommerce\Admin\Notes

Notes::get_notes()public staticWC 1.0

Get notes from the database.

Метод класса: Notes{}

Хуки из метода

Возвращает

Массив. Array of arrays.

Использование

$result = Notes::get_notes( $context, $args );
$context(строка)
Getting notes for what context. Valid values: view, edit.
По умолчанию: 'edit'
$args(массив)
Arguments to pass to the query( e.g. per_page and page).
По умолчанию: array()

Код Notes::get_notes() WC 9.3.3

public static function get_notes( $context = 'edit', $args = array() ) {
	$data_store = self::load_data_store();
	$raw_notes  = $data_store->get_notes( $args );
	$notes      = array();
	foreach ( (array) $raw_notes as $raw_note ) {
		try {
			$note = new Note( $raw_note );
			/**
			 * Filter the note from db. This is used to modify the note before it is returned.
			 *
			 * @since 6.9.0
			 * @param Note $note The note object from the database.
			 */
			$note                               = apply_filters( 'woocommerce_get_note_from_db', $note );
			$note_id                            = $note->get_id();
			$notes[ $note_id ]                  = $note->get_data();
			$notes[ $note_id ]['name']          = $note->get_name( $context );
			$notes[ $note_id ]['type']          = $note->get_type( $context );
			$notes[ $note_id ]['locale']        = $note->get_locale( $context );
			$notes[ $note_id ]['title']         = $note->get_title( $context );
			$notes[ $note_id ]['content']       = $note->get_content( $context );
			$notes[ $note_id ]['content_data']  = $note->get_content_data( $context );
			$notes[ $note_id ]['status']        = $note->get_status( $context );
			$notes[ $note_id ]['source']        = $note->get_source( $context );
			$notes[ $note_id ]['date_created']  = $note->get_date_created( $context );
			$notes[ $note_id ]['date_reminder'] = $note->get_date_reminder( $context );
			$notes[ $note_id ]['actions']       = $note->get_actions( $context );
			$notes[ $note_id ]['layout']        = $note->get_layout( $context );
			$notes[ $note_id ]['image']         = $note->get_image( $context );
			$notes[ $note_id ]['is_deleted']    = $note->get_is_deleted( $context );
		} catch ( \Exception $e ) {
			wc_caught_exception( $e, __CLASS__ . '::' . __FUNCTION__, array( $note_id ) );
		}
	}
	return $notes;
}