Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::get_bulk_actions()protectedWC 1.0

Returns a list of available bulk actions.

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

Хуков нет.

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_bulk_actions() : array;

Заметки

  • Global. Строка. $comment_status

Код ReviewsListTable::get_bulk_actions() WC 8.7.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;
}