woocommerce/plugins/woocommerce-blocks/assets/php/class-wgpb-block-product-to...

46 lines
1018 B
PHP

<?php
/**
* Display the Top Rated Products block in the post content.
* NOTE: DO NOT edit this file in WooCommerce core, this is generated from woocommerce-gutenberg-products-block.
*
* @package WooCommerce\Blocks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handler for getting top-rated products for display.
*/
class WGPB_Block_Product_Top_Rated extends WGPB_Block_Grid_Base {
/**
* Block name.
*
* @var string
*/
protected $block_name = 'product-top-rated';
/**
* Get the block's attributes.
*
* @param array $attributes Block attributes. Default empty array.
* @return array Block attributes merged with defaults.
*/
protected function parse_attributes( $attributes ) {
$attributes = parent::parse_attributes( $attributes );
// Force orderby to rating.
$attributes['orderby'] = 'rating';
return $attributes;
}
/**
* Set args specific to this block
*
* @param array $query_args Query args.
*/
protected function set_block_query_args( &$query_args ) {}
}