Automattic\WooCommerce\Admin\Notes

DataStore::read_actions()privateWC 1.0

Read actions from the database.

Method of the class: DataStore{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->read_actions( $note );
$note(Note) (required) (passed by reference — &)
Admin note.

DataStore::read_actions() code WC 8.7.0

private function read_actions( &$note ) {
	global $wpdb;

	$db_actions = $wpdb->get_results(
		$wpdb->prepare(
			"SELECT action_id, name, label, query, status, actioned_text, nonce_action, nonce_name
			FROM {$wpdb->prefix}wc_admin_note_actions
			WHERE note_id = %d",
			$note->get_id()
		)
	);

	$note_actions = array();

	if ( $db_actions ) {
		foreach ( $db_actions as $action ) {
			$note_actions[] = (object) array(
				'id'            => (int) $action->action_id,
				'name'          => $action->name,
				'label'         => $action->label,
				'query'         => $action->query,
				'status'        => $action->status,
				'actioned_text' => $action->actioned_text,
				'nonce_action'  => $action->nonce_action,
				'nonce_name'    => $action->nonce_name,
			);
		}
	}

	$note->set_actions( $note_actions );
}