Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::get_bulk_actions()protectedWC 1.0

Returns a list of available bulk actions.

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

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_bulk_actions() : array;

Notes

  • Global. String. $comment_status

Code of ReviewsListTable::get_bulk_actions() WC 7.1.0

protected function get_bulk_actions() : array {
	global $comment_status;

	$actions = [];

	if ( in_array( $comment_status, [ 'all', 'approved' ], true ) ) {
		$actions['unapprove'] = __( 'Unapprove', 'woocommerce' );
	}

	if ( in_array( $comment_status, [ 'all', 'moderated' ], true ) ) {
		$actions['approve'] = __( 'Approve', 'woocommerce' );
	}

	if ( in_array( $comment_status, [ 'all', 'moderated', 'approved', 'trash' ], true ) ) {
		$actions['spam'] = _x( 'Mark as spam', 'review', 'woocommerce' );
	}

	if ( 'trash' === $comment_status ) {
		$actions['untrash'] = __( 'Restore', 'woocommerce' );
	} elseif ( 'spam' === $comment_status ) {
		$actions['unspam'] = _x( 'Not spam', 'review', 'woocommerce' );
	}

	if ( in_array( $comment_status, [ 'trash', 'spam' ], true ) || ! EMPTY_TRASH_DAYS ) {
		$actions['delete'] = __( 'Delete permanently', 'woocommerce' );
	} else {
		$actions['trash'] = __( 'Move to Trash', 'woocommerce' );
	}

	return $actions;
}