| @@ -29,20 +29,8 @@ | ||
| 29 | 29 | public function get_keywords() { |
| 30 | 30 | return [ 'star', 'rating', 'review', 'score', 'scale' ]; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - protected function is_dynamic_content(): bool { | |
| 34 | - return false; | |
| 35 | - } | |
| 36 | - | |
| 37 | - public function get_style_depends(): array { | |
| 38 | - return [ 'widget-rating' ]; | |
| 39 | - } | |
| 40 | - | |
| 41 | - public function has_widget_inner_wrapper(): bool { | |
| 42 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 43 | - } | |
| 44 | - | |
| 45 | 33 | /** |
| 46 | 34 | * @return void |
| 47 | 35 | */ |
| 48 | 36 | private function add_style_tab() { |
| @@ -58,22 +46,21 @@ | ||
| 58 | 46 | 'icon_size', |
| 59 | 47 | [ |
| 60 | 48 | 'label' => esc_html__( 'Size', 'elementor' ), |
| 61 | 49 | 'type' => Controls_Manager::SLIDER, |
| 62 | - 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], | |
| 63 | 50 | 'range' => [ |
| 64 | - 'px' => [ | |
| 65 | - 'max' => 100, | |
| 66 | - ], | |
| 67 | 51 | 'em' => [ |
| 68 | 52 | 'min' => 0, |
| 69 | 53 | 'max' => 10, |
| 54 | + 'step' => 0.1, | |
| 70 | 55 | ], |
| 71 | 56 | 'rem' => [ |
| 72 | 57 | 'min' => 0, |
| 73 | 58 | 'max' => 10, |
| 59 | + 'step' => 0.1, | |
| 74 | 60 | ], |
| 75 | 61 | ], |
| 62 | + 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], | |
| 76 | 63 | 'selectors' => [ |
| 77 | 64 | '{{WRAPPER}}' => '--e-rating-icon-font-size: {{SIZE}}{{UNIT}}', |
| 78 | 65 | ], |
| 79 | 66 | ] |
| @@ -83,22 +70,21 @@ | ||
| 83 | 70 | 'icon_gap', |
| 84 | 71 | [ |
| 85 | 72 | 'label' => esc_html__( 'Spacing', 'elementor' ), |
| 86 | 73 | 'type' => Controls_Manager::SLIDER, |
| 87 | - 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], | |
| 88 | 74 | 'range' => [ |
| 89 | - 'px' => [ | |
| 90 | - 'max' => 100, | |
| 91 | - ], | |
| 92 | 75 | 'em' => [ |
| 93 | 76 | 'min' => 0, |
| 94 | 77 | 'max' => 10, |
| 78 | + 'step' => 0.1, | |
| 95 | 79 | ], |
| 96 | 80 | 'rem' => [ |
| 97 | 81 | 'min' => 0, |
| 98 | 82 | 'max' => 10, |
| 83 | + 'step' => 0.1, | |
| 99 | 84 | ], |
| 100 | 85 | ], |
| 86 | + 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], | |
| 101 | 87 | 'selectors' => [ |
| 102 | 88 | '{{WRAPPER}}' => '--e-rating-gap: {{SIZE}}{{UNIT}}', |
| 103 | 89 | ], |
| 104 | 90 | ] |
| @@ -151,10 +137,11 @@ | ||
| 151 | 137 | 'min' => 1, |
| 152 | 138 | 'max' => 10, |
| 153 | 139 | ], |
| 154 | 140 | ], |
| 141 | + 'step' => 1, | |
| 155 | 142 | 'default' => [ |
| 156 | - 'size' => 5, | |
| 143 | + 'size' => '5', | |
| 157 | 144 | ], |
| 158 | 145 | ] |
| 159 | 146 | ); |
| 160 | 147 | |
| @@ -304,11 +291,9 @@ | ||
| 304 | 291 | 'class' => 'e-rating-wrapper', |
| 305 | 292 | 'itemprop' => 'ratingValue', |
| 306 | 293 | 'content' => $this->get_rating_value(), |
| 307 | 294 | 'role' => 'img', |
| 308 | - 'aria-label' => sprintf( | |
| 309 | - /* translators: 1: Rating value, 2: Rating scale. */ | |
| 310 | - esc_html__( 'Rated %1$s out of %2$s', 'elementor' ), | |
| 295 | + 'aria-label' => sprintf( esc_html__( 'Rated %1$s out of %2$s', 'elementor' ), | |
| 311 | 296 | $this->get_rating_value(), |
| 312 | 297 | $this->get_rating_scale() |
| 313 | 298 | ), |
| 314 | 299 | ] ); |
| @@ -320,16 +305,6 @@ | ||
| 320 | 305 | <?php echo $this->get_icon_markup(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 321 | 306 | </div> |
| 322 | 307 | </div> |
| 323 | 308 | <?php |
| 324 | - } | |
| 325 | - | |
| 326 | - public function render_markdown(): string { | |
| 327 | - $settings = $this->get_settings_for_display(); | |
| 328 | - $value = $settings['rating_value'] ?? ''; | |
| 329 | - $scale = $settings['rating_scale']['size'] ?? ( $settings['rating_scale'] ?? '5' ); | |
| 330 | - if ( empty( $value ) ) { | |
| 331 | - return ''; | |
| 332 | - } | |
| 333 | - return $value . '/' . $scale; | |
| 334 | 309 | } |
| 335 | 310 | } |