| @@ -189,8 +189,9 @@ | ||
| 189 | 189 | // an editor has filled it with blocks. Unset, the renderer draws |
| 190 | 190 | // its own rows, which is what the shortcode and the product page |
| 191 | 191 | // get. |
| 192 | 192 | 'rows_renderer' => null, |
| 193 | + 'listClientId' => '', | |
| 193 | 194 | // The lowest rating the list shows, lifted off the Review Item |
| 194 | 195 | // block. 0 is every review. |
| 195 | 196 | 'minRating' => 0, |
| 196 | 197 | // 'numbers' | 'fraction' | 'bullets'. Printed on the container so |
| @@ -242,8 +243,13 @@ | ||
| 242 | 243 | // Where the reviews endpoint can find the same composed row |
| 243 | 244 | // again. Set only by the Review List block, and only when it has |
| 244 | 245 | // children to compose. |
| 245 | 246 | ]), $this->postId); |
| 247 | + $this->renderOptions['minRating'] = ProductReviewService::resolveListMinRating( | |
| 248 | + (string) Arr::get($this->renderOptions, 'listClientId', ''), | |
| 249 | + (int) Arr::get($this->renderOptions, 'minRating', 0), | |
| 250 | + (int) $this->postId | |
| 251 | + ); | |
| 246 | 252 | } |
| 247 | 253 | |
| 248 | 254 | /** |
| 249 | 255 | * The item this placement is bound to, 0 for the product as a whole. |
| @@ -576,8 +582,9 @@ | ||
| 576 | 582 | data-rest-url="<?php echo esc_url($restInfo['url']); ?>" |
| 577 | 583 | data-rest-nonce="<?php echo esc_attr($restInfo['nonce']); ?>" |
| 578 | 584 | data-per-page="<?php echo esc_attr($perPage); ?>" |
| 579 | 585 | data-min-rating="<?php echo esc_attr($minRating); ?>" |
| 586 | + data-rating-token="<?php echo esc_attr(ProductReviewService::listRatingToken((int) $this->postId, $minRating)); ?>" | |
| 580 | 587 | data-default-sort="<?php echo esc_attr($defaultSort); ?>" |
| 581 | 588 | data-show-verified="<?php echo $showVerifiedBadge ? '1' : '0'; ?>" |
| 582 | 589 | data-show-date="<?php echo $showReviewDate ? '1' : '0'; ?>" |
| 583 | 590 | data-show-reviewer="<?php echo $showReviewerName ? '1' : '0'; ?>" |
| @@ -692,8 +699,11 @@ | ||
| 692 | 699 | <?php if ($isSlider) : ?> |
| 693 | 700 | data-reviews-slider="<?php echo (int) $gridColumns; ?>" |
| 694 | 701 | data-slider-settings="<?php echo esc_attr(wp_json_encode($sliderSettings)); ?>" |
| 695 | 702 | <?php endif; ?> |
| 703 | + <?php if (Arr::get($this->renderOptions, 'listClientId', '') !== '') : ?> | |
| 704 | + data-client-id="<?php echo esc_attr((string) Arr::get($this->renderOptions, 'listClientId', '')); ?>" | |
| 705 | + <?php endif; ?> | |
| 696 | 706 | data-reviews-list> |
| 697 | 707 | <?php echo $initialRows; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 698 | 708 | </div> |
| 699 | 709 | <?php endif; ?> |
| @@ -994,10 +1004,20 @@ | ||
| 994 | 1004 | // thread modal, which has its own rules and never takes the open class |
| 995 | 1005 | // this overlay animates on. Sharing the name made the thread modal |
| 996 | 1006 | // inherit this one's hidden state and render transparent. |
| 997 | 1007 | ?> |
| 1008 | + <?php | |
| 1009 | + // Same flag, same class name, same reason as CartDrawerRenderer: | |
| 1010 | + // the admin bar is also position:fixed; top:0, at a higher | |
| 1011 | + // z-index than this overlay, and both this panel and the cart | |
| 1012 | + // drawer are now direct children of <body> (see ReviewForm.js's | |
| 1013 | + // getDrawer()), so the bar paints over whichever one assumes it | |
| 1014 | + // owns the full viewport height. admin_bar_enabled's CSS trims | |
| 1015 | + // that height back the same way for both. | |
| 1016 | + $isAdminBarEnabled = is_admin_bar_showing(); | |
| 1017 | + ?> | |
| 998 | 1018 | <div class="<?php echo $isModal ? 'fct-review-form-modal-overlay' : 'fct-review-drawer-overlay'; ?>" data-review-drawer style="display:none;"> |
| 999 | - <div class="<?php echo $isModal ? 'fct-review-form-modal' : 'fct-review-drawer'; ?>" data-review-drawer-panel role="dialog" aria-modal="true" aria-labelledby="<?php echo esc_attr($titleId); ?>" tabindex="-1"> | |
| 1019 | + <div class="<?php echo $isModal ? 'fct-review-form-modal' : 'fct-review-drawer'; ?><?php echo $isAdminBarEnabled ? ' admin_bar_enabled' : ''; ?>" data-review-drawer-panel role="dialog" aria-modal="true" aria-labelledby="<?php echo esc_attr($titleId); ?>" tabindex="-1"> | |
| 1000 | 1020 | <div class="fct-review-drawer-header"> |
| 1001 | 1021 | <h4 class="fct-review-drawer-title" data-review-drawer-title id="<?php echo esc_attr($titleId); ?>"><?php esc_html_e('Write a review', 'fluent-cart'); ?></h4> |
| 1002 | 1022 | <button type="button" class="fct-review-drawer-close" data-close-review-drawer aria-label="<?php esc_attr_e('Close', 'fluent-cart'); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true" focusable="false"><path d="M12.8337 1.16663L1.16699 12.8333M1.16699 1.16663L12.8337 12.8333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button> |
| 1003 | 1023 | </div> |