block.json
6 months ago
controller.php
6 months ago
index.asset.php
4 months ago
index.js
4 months ago
style-index-rtl.css
4 months ago
style-index.css
4 months ago
view.php
6 months ago
controller.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | $product = sc_get_product(); |
| 4 | |
| 5 | if ( ! $product ) { |
| 6 | return; |
| 7 | } |
| 8 | |
| 9 | $total = (int) $product->total_reviews; |
| 10 | $columns = $attributes['columns'] ?? null; |
| 11 | |
| 12 | $style_vars = array_filter( |
| 13 | [ |
| 14 | '--sc-row-gap' => $attributes['row_gap'] ?? null, |
| 15 | '--sc-column-gap' => $attributes['column_gap'] ?? null, |
| 16 | '--sc-star-fill-color' => $attributes['fill_color'] ?? null, |
| 17 | '--sc-star-stroke-color' => $attributes['fill_color'] ?? null, |
| 18 | '--sc-star-size' => $attributes['size'] ?? null, |
| 19 | '--sc-star-bar-background-color' => $attributes['bar_background_color'] ?? null, |
| 20 | '--sc-star-bar-fill-color' => $attributes['bar_fill_color'] ?? null, |
| 21 | ] |
| 22 | ); |
| 23 | |
| 24 | $style = implode( |
| 25 | ' ', |
| 26 | array_map( |
| 27 | function ( $property, $value ) { |
| 28 | return esc_attr( $property ) . ': ' . esc_attr( $value ) . ';'; |
| 29 | }, |
| 30 | array_keys( $style_vars ), |
| 31 | $style_vars |
| 32 | ) |
| 33 | ); |
| 34 | |
| 35 | return 'file:./view.php'; |
| 36 |