| @@ -161,20 +161,24 @@ | ||
| 161 | 161 | $this->start_injection([ |
| 162 | 162 | 'of' => 'show_button', |
| 163 | 163 | 'at' => 'after', |
| 164 | 164 | ]); |
| 165 | + | |
| 166 | + if (defined('UICORE_ASSETS')) { | |
| 167 | + $this->add_control( | |
| 168 | + 'show_swatches', | |
| 169 | + [ | |
| 170 | + 'label' => esc_html__('Swatches', 'uicore-elements'), | |
| 171 | + 'type' => \Elementor\Controls_Manager::SWITCHER, | |
| 172 | + 'label_on' => esc_html__('Show', 'uicore-elements'), | |
| 173 | + 'label_off' => esc_html__('Hide', 'uicore-elements'), | |
| 174 | + 'description' => esc_html__('Will only work if you have Uicore Framework plugin active at least on version 6.0.1', 'uicore-elements'), | |
| 175 | + 'default' => 'yes', | |
| 176 | + ] | |
| 177 | + ); | |
| 178 | + } | |
| 179 | + | |
| 165 | 180 | $this->add_control( |
| 166 | - 'show_swatches', | |
| 167 | - [ | |
| 168 | - 'label' => esc_html__('Swatches', 'uicore-elements'), | |
| 169 | - 'type' => \Elementor\Controls_Manager::SWITCHER, | |
| 170 | - 'label_on' => esc_html__('Show', 'uicore-elements'), | |
| 171 | - 'label_off' => esc_html__('Hide', 'uicore-elements'), | |
| 172 | - 'description' => esc_html__('Will only work if you have Uicore Framework plugin active at least on version 6.0.1', 'uicore-elements'), | |
| 173 | - 'default' => 'yes', | |
| 174 | - ] | |
| 175 | - ); | |
| 176 | - $this->add_control( | |
| 177 | 181 | 'show_sale_badge', |
| 178 | 182 | [ |
| 179 | 183 | 'label' => esc_html__('Sale Badge', 'uicore-elements'), |
| 180 | 184 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| @@ -194,10 +198,188 @@ | ||
| 194 | 198 | 'show_sale_badge' => 'yes', |
| 195 | 199 | ], |
| 196 | 200 | ] |
| 197 | 201 | ); |
| 202 | + | |
| 198 | 203 | $this->end_injection(); |
| 199 | 204 | |
| 205 | + if (defined('UICORE_ASSETS')) { | |
| 206 | + $this->start_injection([ | |
| 207 | + 'of' => 'section_style_content', | |
| 208 | + 'at' => 'after', | |
| 209 | + ]); | |
| 210 | + $this->start_controls_section( | |
| 211 | + 'section_swatches', | |
| 212 | + [ | |
| 213 | + 'label' => esc_html__('Swatches', 'uicore-elements') . UICORE_ELEMENTS_NEW_OPTION, | |
| 214 | + 'tab' => \Elementor\Controls_Manager::TAB_STYLE, | |
| 215 | + 'condition' => [ | |
| 216 | + 'show_swatches' => 'yes', | |
| 217 | + ], | |
| 218 | + ] | |
| 219 | + ); | |
| 220 | + | |
| 221 | + $this->add_control( | |
| 222 | + 'swatches_to', | |
| 223 | + [ | |
| 224 | + 'label' => esc_html__('Use Framework defaults', 'uicore-elements'), | |
| 225 | + 'type' => \Elementor\Controls_Manager::SWITCHER, | |
| 226 | + 'description' => esc_html__('If enabled, the swatches will inherit your theme options.', 'uicore-elements'), | |
| 227 | + 'label_on' => esc_html__('Yes', 'uicore-elements'), | |
| 228 | + 'label_off' => esc_html__('No', 'uicore-elements'), | |
| 229 | + 'default' => 'yes', | |
| 230 | + ] | |
| 231 | + ); | |
| 232 | + | |
| 233 | + $this->add_control( | |
| 234 | + 'swatches_size', | |
| 235 | + [ | |
| 236 | + 'label' => esc_html__('Size', 'uicore-elements'), | |
| 237 | + 'type' => \Elementor\Controls_Manager::SLIDER, | |
| 238 | + 'size_units' => ['px'], | |
| 239 | + 'range' => [ | |
| 240 | + 'px' => [ | |
| 241 | + 'min' => 10, | |
| 242 | + 'max' => 100, | |
| 243 | + ], | |
| 244 | + ], | |
| 245 | + 'default' => [ | |
| 246 | + 'unit' => 'px', | |
| 247 | + 'size' => 30, | |
| 248 | + ], | |
| 249 | + 'condition' => [ | |
| 250 | + 'show_swatches' => 'yes', | |
| 251 | + 'swatches_to!' => 'yes', | |
| 252 | + ], | |
| 253 | + 'selectors' => [ | |
| 254 | + '{{WRAPPER}}' => '--uicore-swatch-size: {{SIZE}}{{UNIT}};', | |
| 255 | + ], | |
| 256 | + ] | |
| 257 | + ); | |
| 258 | + | |
| 259 | + $this->add_control( | |
| 260 | + 'swatches_outer_radius', | |
| 261 | + [ | |
| 262 | + 'label' => esc_html__('Outer Border Radius', 'uicore-elements'), | |
| 263 | + 'type' => \Elementor\Controls_Manager::SLIDER, | |
| 264 | + 'size_units' => ['%', 'px'], | |
| 265 | + 'range' => [ | |
| 266 | + '%' => [ | |
| 267 | + 'min' => 0, | |
| 268 | + 'max' => 100, | |
| 269 | + ], | |
| 270 | + 'px' => [ | |
| 271 | + 'min' => 0, | |
| 272 | + 'max' => 50, | |
| 273 | + ], | |
| 274 | + ], | |
| 275 | + 'default' => [ | |
| 276 | + 'unit' => '%', | |
| 277 | + 'size' => 50, | |
| 278 | + ], | |
| 279 | + 'separator' => 'before', | |
| 280 | + 'condition' => [ | |
| 281 | + 'show_swatches' => 'yes', | |
| 282 | + 'swatches_to!' => 'yes', | |
| 283 | + ], | |
| 284 | + 'selectors' => [ | |
| 285 | + '{{WRAPPER}}' => '--uicore-swatch-radius: {{SIZE}}{{UNIT}}; --uicore-swatch-big-radius: {{SIZE}}{{UNIT}};', | |
| 286 | + '{{WRAPPER}} .uicore-swatch.uicore-swatch--color' => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 287 | + ], | |
| 288 | + ] | |
| 289 | + ); | |
| 290 | + | |
| 291 | + $this->add_control( | |
| 292 | + 'swatches_inner_radius', | |
| 293 | + [ | |
| 294 | + 'label' => esc_html__('Inner Border Radius', 'uicore-elements'), | |
| 295 | + 'type' => \Elementor\Controls_Manager::SLIDER, | |
| 296 | + 'size_units' => ['px', '%'], | |
| 297 | + 'range' => [ | |
| 298 | + 'px' => [ | |
| 299 | + 'min' => 0, | |
| 300 | + | |
| 301 | + 'max' => 100, | |
| 302 | + ], | |
| 303 | + '%' => [ | |
| 304 | + 'min' => 0, | |
| 305 | + 'max' => 50, | |
| 306 | + ], | |
| 307 | + ], | |
| 308 | + 'default' => [ | |
| 309 | + 'unit' => 'px', | |
| 310 | + 'size' => 4, | |
| 311 | + ], | |
| 312 | + 'separator' => 'after', | |
| 313 | + 'condition' => [ | |
| 314 | + 'show_swatches' => 'yes', | |
| 315 | + 'swatches_to!' => 'yes', | |
| 316 | + ], | |
| 317 | + 'selectors' => [ | |
| 318 | + '{{WRAPPER}} .uicore-swatch > div' => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 319 | + ], | |
| 320 | + ] | |
| 321 | + ); | |
| 322 | + | |
| 323 | + $this->add_group_control( | |
| 324 | + \Elementor\Group_Control_Border::get_type(), | |
| 325 | + [ | |
| 326 | + 'name' => 'swatch_border', | |
| 327 | + 'selector' => '{{WRAPPER}} .uicore-swatch', | |
| 328 | + 'condition' => [ | |
| 329 | + 'show_swatches' => 'yes', | |
| 330 | + 'swatches_to!' => 'yes', | |
| 331 | + ], | |
| 332 | + ] | |
| 333 | + ); | |
| 334 | + | |
| 335 | + $this->add_control( | |
| 336 | + 'hover_border_size', | |
| 337 | + [ | |
| 338 | + 'label' => esc_html__('Hover Border Size', 'uicore-elements'), | |
| 339 | + 'type' => \Elementor\Controls_Manager::SLIDER, | |
| 340 | + 'size_units' => ['px'], | |
| 341 | + 'range' => [ | |
| 342 | + 'px' => [ | |
| 343 | + 'min' => 0, | |
| 344 | + | |
| 345 | + 'max' => 5, | |
| 346 | + ], | |
| 347 | + ], | |
| 348 | + 'default' => [ | |
| 349 | + 'unit' => 'px', | |
| 350 | + 'size' => 1, | |
| 351 | + ], | |
| 352 | + 'condition' => [ | |
| 353 | + 'show_swatches' => 'yes', | |
| 354 | + 'swatches_to!' => 'yes', | |
| 355 | + ], | |
| 356 | + 'selectors' => [ | |
| 357 | + '{{WRAPPER}} .uicore-swatch:hover' => 'box-shadow: 0 0 0 {{SIZE}}{{UNIT}} var(--uicore-swatch-border);', | |
| 358 | + ], | |
| 359 | + ] | |
| 360 | + ); | |
| 361 | + | |
| 362 | + $this->add_control( | |
| 363 | + 'swatch_hover_color', | |
| 364 | + [ | |
| 365 | + 'label' => esc_html__('Hover Border Color', 'uicore-elements'), | |
| 366 | + 'type' => \Elementor\Controls_Manager::COLOR, | |
| 367 | + 'condition' => [ | |
| 368 | + 'show_swatches' => 'yes', | |
| 369 | + 'swatches_to!' => 'yes', | |
| 370 | + ], | |
| 371 | + 'selectors' => [ | |
| 372 | + '{{WRAPPER}}' => '--uicore-swatch-border: {{VALUE}};', | |
| 373 | + '{{WRAPPER}} .uicore-swatch:hover' => 'border-color: {{VALUE}};', | |
| 374 | + ], | |
| 375 | + ] | |
| 376 | + ); | |
| 377 | + | |
| 378 | + $this->end_controls_section(); | |
| 379 | + $this->end_injection(); | |
| 380 | + } | |
| 381 | + | |
| 200 | 382 | // Register new Hide out of stock products control |
| 201 | 383 | $this->start_injection([ |
| 202 | 384 | 'of' => 'sticky', |
| 203 | 385 | 'at' => 'before', |
| @@ -213,9 +395,8 @@ | ||
| 213 | 395 | ] |
| 214 | 396 | ); |
| 215 | 397 | $this->end_injection(); |
| 216 | 398 | |
| 217 | - // | |
| 218 | 399 | $this->start_injection([ |
| 219 | 400 | 'of' => 'text', |
| 220 | 401 | 'at' => 'after', |
| 221 | 402 | ]); |