BuyButton.php
3 months ago
CartMenuIcon.php
5 months ago
CollectionTag.php
1 year ago
CollectionTags.php
1 year ago
Media.php
1 year ago
PriceChoiceTemplate.php
1 year ago
PriceChooser.php
4 months ago
PriceData.php
1 year ago
Product.php
4 months ago
ProductCard.php
10 months ago
ProductContent.php
10 months ago
ProductData.php
1 year ago
ProductLineItemNote.php
10 months ago
ProductQuickAddButton.php
10 months ago
ProductReviewAverageRatingStars.php
4 months ago
ProductReviewAverageRatingValue.php
4 months ago
ProductReviewBreakdown.php
4 months ago
ProductReviewContent.php
4 months ago
ProductReviewList.php
2 months ago
ProductReviewRating.php
4 months ago
ProductReviewTotalRating.php
4 months ago
ProductReviews.php
4 months ago
Quantity.php
10 months ago
SaleBadge.php
1 year ago
SelectedPriceAdHocAmount.php
1 year ago
VariantPill.php
6 months ago
VariantPills.php
1 year ago
ProductReviewRating.php
120 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Integrations\Bricks\Elements; |
| 4 | |
| 5 | use SureCart\Integrations\Bricks\Concerns\ConvertsBlocks; |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly. |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Product Review Rating element. |
| 13 | */ |
| 14 | class ProductReviewRating extends \Bricks\Element { |
| 15 | use ConvertsBlocks; |
| 16 | |
| 17 | /** |
| 18 | * Element category. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public $category = 'SureCart Layout'; |
| 23 | |
| 24 | /** |
| 25 | * Element name. |
| 26 | * |
| 27 | * @var string |
| 28 | */ |
| 29 | public $name = 'surecart-product-rating'; |
| 30 | |
| 31 | /** |
| 32 | * Element block name. |
| 33 | * |
| 34 | * @var string |
| 35 | */ |
| 36 | public $block_name = 'surecart/product-rating'; |
| 37 | |
| 38 | /** |
| 39 | * Element icon. |
| 40 | * |
| 41 | * @var string |
| 42 | */ |
| 43 | public $icon = 'ti-star'; |
| 44 | |
| 45 | /** |
| 46 | * This is nestable. |
| 47 | * |
| 48 | * @var bool |
| 49 | */ |
| 50 | public $nestable = true; |
| 51 | |
| 52 | /** |
| 53 | * Get element label. |
| 54 | * |
| 55 | * @return string |
| 56 | */ |
| 57 | public function get_label() { |
| 58 | return esc_html__( 'Product Rating', 'surecart' ); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Get nestable children. |
| 63 | * |
| 64 | * @return array |
| 65 | */ |
| 66 | public function get_nestable_children() { |
| 67 | return array( |
| 68 | array( |
| 69 | 'name' => 'container', |
| 70 | 'label' => esc_html__( 'Rating Container', 'surecart' ), |
| 71 | 'settings' => array( |
| 72 | '_direction' => 'row', |
| 73 | '_alignItems' => 'center', |
| 74 | '_columnGap' => '6px', |
| 75 | '_justifyContent' => 'flex-start', |
| 76 | ), |
| 77 | 'children' => array( |
| 78 | array( |
| 79 | 'name' => 'surecart-product-review-average-rating-stars', |
| 80 | 'settings' => array( |
| 81 | '_typography' => array( |
| 82 | 'line-height' => '1', |
| 83 | ), |
| 84 | ), |
| 85 | ), |
| 86 | array( |
| 87 | 'name' => 'surecart-product-review-average-rating-value', |
| 88 | 'settings' => array( |
| 89 | 'format_style' => 'parentheses', |
| 90 | ), |
| 91 | ), |
| 92 | array( |
| 93 | 'name' => 'surecart-product-review-total-rating', |
| 94 | 'settings' => array( |
| 95 | 'style_variant' => 'plus-sign', |
| 96 | 'show_label' => true, |
| 97 | ), |
| 98 | ), |
| 99 | ), |
| 100 | ), |
| 101 | ); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Render element. |
| 106 | * |
| 107 | * @return void |
| 108 | */ |
| 109 | public function render() { |
| 110 | $output = "<div {$this->render_attributes( '_root' )}>"; |
| 111 | |
| 112 | // Render children elements (= individual items). |
| 113 | $output .= \Bricks\Frontend::render_children( $this ); |
| 114 | |
| 115 | $output .= '</div>'; |
| 116 | |
| 117 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 118 | } |
| 119 | } |
| 120 |