← All changes
|
inc/ExternalPlugin/Elementor/LPElementorControls.php
+591
-591
4.3.9
→
4.4.8
View file →
| @@ -1,591 +1,591 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Class LP_Elementor_Widgets | |
| 4 | - * | |
| 5 | - * @since 4.2.3 | |
| 6 | - * @version 1.0.1 | |
| 7 | - */ | |
| 8 | - | |
| 9 | -namespace LearnPress\ExternalPlugin\Elementor; | |
| 10 | - | |
| 11 | -use Elementor\Controls_Manager; | |
| 12 | -use Elementor\Group_Control_Border; | |
| 13 | -use Elementor\Group_Control_Text_Shadow; | |
| 14 | -use Elementor\Group_Control_Typography; | |
| 15 | - | |
| 16 | -class LPElementorControls { | |
| 17 | - /** | |
| 18 | - * Start section. | |
| 19 | - * | |
| 20 | - * @param string $id | |
| 21 | - * @param string $label | |
| 22 | - * @param string $tab | |
| 23 | - * @param array $args | |
| 24 | - * | |
| 25 | - * @return string[] | |
| 26 | - */ | |
| 27 | - private static function add_start_section( | |
| 28 | - string $id, | |
| 29 | - string $label, | |
| 30 | - string $tab = Controls_Manager::TAB_CONTENT, | |
| 31 | - array $args = [] | |
| 32 | - ): array { | |
| 33 | - return [ | |
| 34 | - 'method' => 'start_controls_section', | |
| 35 | - 'id' => $id, | |
| 36 | - array_merge( | |
| 37 | - [ | |
| 38 | - 'label' => $label, | |
| 39 | - 'tab' => $tab, | |
| 40 | - ], | |
| 41 | - $args | |
| 42 | - ), | |
| 43 | - ]; | |
| 44 | - } | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * Start section. | |
| 48 | - * | |
| 49 | - * @param string $id_section | |
| 50 | - * @param string $label_section | |
| 51 | - * @param string $tab | |
| 52 | - * @param array $fields_inner | |
| 53 | - * @param array $args_section | |
| 54 | - * | |
| 55 | - * @return string[] | |
| 56 | - */ | |
| 57 | - public static function add_fields_in_section( | |
| 58 | - string $id_section, | |
| 59 | - string $label_section, | |
| 60 | - string $tab = Controls_Manager::TAB_CONTENT, | |
| 61 | - array $fields_inner = [], | |
| 62 | - array $args_section = [] | |
| 63 | - ): array { | |
| 64 | - return array_merge( | |
| 65 | - [ | |
| 66 | - "section_$id_section" => LPElementorControls::add_start_section( | |
| 67 | - "section_$id_section", | |
| 68 | - $label_section, | |
| 69 | - $tab, | |
| 70 | - $args_section | |
| 71 | - ), | |
| 72 | - ], | |
| 73 | - $fields_inner, | |
| 74 | - [ "end_section_$id_section" => [ 'method' => 'end_controls_section' ] ] | |
| 75 | - ); | |
| 76 | - } | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * Controls Tabs. | |
| 80 | - * | |
| 81 | - * @param string $id | |
| 82 | - * @param array $control_tab_inner | |
| 83 | - * | |
| 84 | - * @return string[] | |
| 85 | - * @since 4.2.3.4 | |
| 86 | - * @version 1.0.0 | |
| 87 | - */ | |
| 88 | - public static function add_start_control_tabs( string $id, array $control_tab_inner = [] ): array { | |
| 89 | - return array_merge( | |
| 90 | - [ | |
| 91 | - 'start_controls_tabs_' . $id => [ | |
| 92 | - 'method' => 'start_controls_tabs', | |
| 93 | - 'id' => $id, | |
| 94 | - ], | |
| 95 | - ], | |
| 96 | - $control_tab_inner, | |
| 97 | - [ 'end_control_tabs_' . $id => [ 'method' => 'end_controls_tabs' ] ] | |
| 98 | - ); | |
| 99 | - } | |
| 100 | - | |
| 101 | - /** | |
| 102 | - * Controls Tab. | |
| 103 | - * | |
| 104 | - * @param string $id | |
| 105 | - * @param string $label | |
| 106 | - * @param array $controls_inner | |
| 107 | - * | |
| 108 | - * @return string[] | |
| 109 | - * @since 4.2.3.4 | |
| 110 | - * @version 1.0.0 | |
| 111 | - */ | |
| 112 | - public static function add_start_control_tab( string $id, string $label = '', array $controls_inner = [] ): array { | |
| 113 | - return array_merge( | |
| 114 | - [ | |
| 115 | - 'start_controls_tab_' . $id => [ | |
| 116 | - 'method' => 'start_controls_tab', | |
| 117 | - 'id' => $id, | |
| 118 | - [ | |
| 119 | - 'label' => $label, | |
| 120 | - ], | |
| 121 | - ], | |
| 122 | - ], | |
| 123 | - $controls_inner, | |
| 124 | - [ 'end_controls_tab_' . $id => [ 'method' => 'end_controls_tab' ] ] | |
| 125 | - ); | |
| 126 | - } | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * Declare control type. | |
| 130 | - * | |
| 131 | - * @param string $id | |
| 132 | - * @param string $control_type | |
| 133 | - * @param string $label | |
| 134 | - * @param string|array $default | |
| 135 | - * @param array $args | |
| 136 | - * | |
| 137 | - * @return string[] | |
| 138 | - */ | |
| 139 | - public static function add_control_type( | |
| 140 | - string $id, | |
| 141 | - string $label, | |
| 142 | - $default = '', | |
| 143 | - string $control_type = Controls_Manager::TEXT, | |
| 144 | - array $args = [] | |
| 145 | - ): array { | |
| 146 | - return [ | |
| 147 | - 'method' => 'add_control', | |
| 148 | - 'id' => $id, | |
| 149 | - array_merge( | |
| 150 | - [ | |
| 151 | - 'label' => $label, | |
| 152 | - 'type' => $control_type, | |
| 153 | - 'default' => $default, | |
| 154 | - ], | |
| 155 | - $args | |
| 156 | - ), | |
| 157 | - ]; | |
| 158 | - } | |
| 159 | - | |
| 160 | - /** | |
| 161 | - * Responsive control type. | |
| 162 | - * | |
| 163 | - * | |
| 164 | - * @param string $id | |
| 165 | - * @param string $label | |
| 166 | - * @param string|array $default | |
| 167 | - * @param string $control_type | |
| 168 | - * @param array $args | |
| 169 | - * | |
| 170 | - * @return array | |
| 171 | - */ | |
| 172 | - public static function add_responsive_control_type( | |
| 173 | - string $id, | |
| 174 | - string $label, | |
| 175 | - $default = '', | |
| 176 | - string $control_type = Controls_Manager::CHOOSE, | |
| 177 | - array $args = [] | |
| 178 | - ): array { | |
| 179 | - return [ | |
| 180 | - 'method' => 'add_responsive_control', | |
| 181 | - 'id' => $id, | |
| 182 | - array_merge( | |
| 183 | - [ | |
| 184 | - 'label' => $label, | |
| 185 | - 'type' => $control_type, | |
| 186 | - 'default' => $default, | |
| 187 | - ], | |
| 188 | - $args | |
| 189 | - ), | |
| 190 | - ]; | |
| 191 | - } | |
| 192 | - | |
| 193 | - /** | |
| 194 | - * control type select. | |
| 195 | - * | |
| 196 | - * @param string $id | |
| 197 | - * @param string $label | |
| 198 | - * @param array $options | |
| 199 | - * @param $default | |
| 200 | - * @param array $args | |
| 201 | - * | |
| 202 | - * @return string[] | |
| 203 | - */ | |
| 204 | - public static function add_control_type_select( | |
| 205 | - string $id, | |
| 206 | - string $label, | |
| 207 | - array $options, | |
| 208 | - $default, | |
| 209 | - array $args = [] | |
| 210 | - ): array { | |
| 211 | - return self::add_control_type( | |
| 212 | - $id, | |
| 213 | - $label, | |
| 214 | - $default, | |
| 215 | - Controls_Manager::SELECT, | |
| 216 | - array_merge( | |
| 217 | - [ | |
| 218 | - 'options' => $options, | |
| 219 | - ], | |
| 220 | - $args | |
| 221 | - ) | |
| 222 | - ); | |
| 223 | - } | |
| 224 | - | |
| 225 | - /** | |
| 226 | - * control type select. | |
| 227 | - * | |
| 228 | - * @param string $id | |
| 229 | - * @param string $label | |
| 230 | - * @param array $selectors | |
| 231 | - * @param string $default | |
| 232 | - * @param array $args | |
| 233 | - * | |
| 234 | - * @return string[] | |
| 235 | - */ | |
| 236 | - public static function add_control_type_switcher( | |
| 237 | - string $id, | |
| 238 | - string $label, | |
| 239 | - array $selectors = [], | |
| 240 | - string $default = 'no', | |
| 241 | - array $args = [] | |
| 242 | - ): array { | |
| 243 | - return self::add_control_type( | |
| 244 | - $id, | |
| 245 | - $label, | |
| 246 | - $default, | |
| 247 | - Controls_Manager::SWITCHER, | |
| 248 | - array_merge( | |
| 249 | - [ | |
| 250 | - 'selectors' => $selectors, | |
| 251 | - ], | |
| 252 | - $args | |
| 253 | - ) | |
| 254 | - ); | |
| 255 | - } | |
| 256 | - | |
| 257 | - /** | |
| 258 | - * control type color. | |
| 259 | - * | |
| 260 | - * @param string $id | |
| 261 | - * @param string $label | |
| 262 | - * @param array $selector | |
| 263 | - * @param array $args | |
| 264 | - * | |
| 265 | - * @return string[] | |
| 266 | - */ | |
| 267 | - public static function add_control_type_color( string $id, string $label, array $selector, array $args = [] ): array { | |
| 268 | - return self::add_control_type( | |
| 269 | - $id, | |
| 270 | - $label, | |
| 271 | - '', | |
| 272 | - Controls_Manager::COLOR, | |
| 273 | - array_merge( [ 'selectors' => $selector ], $args ) | |
| 274 | - ); | |
| 275 | - } | |
| 276 | - | |
| 277 | - /** | |
| 278 | - * Declare control type slider. | |
| 279 | - * | |
| 280 | - * @param string $id | |
| 281 | - * @param string $label | |
| 282 | - * @param float $default | |
| 283 | - * @param string $unit | |
| 284 | - * @param array $args | |
| 285 | - * | |
| 286 | - * @return string[] | |
| 287 | - */ | |
| 288 | - public static function add_control_type_slider( | |
| 289 | - string $id, | |
| 290 | - string $label, | |
| 291 | - float $default = 0, | |
| 292 | - string $unit = 'px', | |
| 293 | - array $args = [] | |
| 294 | - ): array { | |
| 295 | - return self::add_control_type( | |
| 296 | - $id, | |
| 297 | - $label, | |
| 298 | - $default, | |
| 299 | - Controls_Manager::SLIDER, | |
| 300 | - array_merge( | |
| 301 | - [ | |
| 302 | - 'range' => array( | |
| 303 | - 'px' => array( | |
| 304 | - 'min' => 0, | |
| 305 | - 'max' => 60, | |
| 306 | - 'step' => 1, | |
| 307 | - ), | |
| 308 | - ), | |
| 309 | - 'default' => array( | |
| 310 | - 'size' => $default, | |
| 311 | - 'unit' => $unit, | |
| 312 | - ), | |
| 313 | - ], | |
| 314 | - $args | |
| 315 | - ) | |
| 316 | - ); | |
| 317 | - } | |
| 318 | - | |
| 319 | - /** | |
| 320 | - * Declare control type. | |
| 321 | - * | |
| 322 | - * @param string $id | |
| 323 | - * @param string $group_type | |
| 324 | - * @param string $selector | |
| 325 | - * @param array $args | |
| 326 | - * | |
| 327 | - * @return string[] | |
| 328 | - */ | |
| 329 | - public static function add_group_control_type( string $id, string $group_type, string $selector, array $args = [] ): array { | |
| 330 | - return [ | |
| 331 | - 'method' => 'add_group_control', | |
| 332 | - $group_type, | |
| 333 | - array_merge( | |
| 334 | - [ | |
| 335 | - 'name' => $id, | |
| 336 | - 'selector' => $selector, | |
| 337 | - ], | |
| 338 | - $args | |
| 339 | - ), | |
| 340 | - ]; | |
| 341 | - } | |
| 342 | - | |
| 343 | - /** | |
| 344 | - * Include or exclude more fields. | |
| 345 | - * | |
| 346 | - * @param array $fields | |
| 347 | - * @param string $prefix_name - prefix name of field for exclude. Format: 'prefix_name'_'field_name_want_exclude' | |
| 348 | - * @param array $include - no need prefix_name, must add by standard format: 'prefix_name'_'btn'_'attribute' | |
| 349 | - * @param array $exclude | |
| 350 | - * | |
| 351 | - * @return array | |
| 352 | - */ | |
| 353 | - private static function add_group_style_controls( | |
| 354 | - array $fields, | |
| 355 | - string $prefix_name, | |
| 356 | - array $include = [], | |
| 357 | - array $exclude = [] | |
| 358 | - ): array { | |
| 359 | - | |
| 360 | - if ( ! empty( $include ) ) { | |
| 361 | - $fields = array_merge( $fields, $include ); | |
| 362 | - } | |
| 363 | - | |
| 364 | - if ( ! empty( $exclude ) ) { | |
| 365 | - foreach ( $exclude as $field ) { | |
| 366 | - $field = "{$prefix_name}_{$field}"; | |
| 367 | - unset( $fields[ $field ] ); | |
| 368 | - } | |
| 369 | - } | |
| 370 | - | |
| 371 | - return $fields; | |
| 372 | - } | |
| 373 | - | |
| 374 | - /** | |
| 375 | - * Group control style for text. | |
| 376 | - * | |
| 377 | - * @param string $prefix_name | |
| 378 | - * @param string $selector | |
| 379 | - * @param array $include | |
| 380 | - * @param array $exclude | |
| 381 | - * | |
| 382 | - * @return array | |
| 383 | - */ | |
| 384 | - public static function add_controls_style_text( | |
| 385 | - string $prefix_name, | |
| 386 | - string $selector, | |
| 387 | - array $include = [], | |
| 388 | - array $exclude = [] | |
| 389 | - ): array { | |
| 390 | - $fields = [ | |
| 391 | - "{$prefix_name}_text_display" => self::add_control_type( | |
| 392 | - "{$prefix_name}_text_display", | |
| 393 | - esc_html__( 'Display', 'learnpress' ), | |
| 394 | - 'block', | |
| 395 | - Controls_Manager::CHOOSE, | |
| 396 | - [ | |
| 397 | - 'options' => [ | |
| 398 | - 'block' => array( | |
| 399 | - 'title' => esc_html__( 'Block', 'learnpress' ), | |
| 400 | - 'icon' => 'eicon-editor-list-ul', | |
| 401 | - ), | |
| 402 | - 'inline-block' => array( | |
| 403 | - 'title' => esc_html__( 'Inline', 'learnpress' ), | |
| 404 | - 'icon' => 'eicon-ellipsis-h', | |
| 405 | - ), | |
| 406 | - ], | |
| 407 | - 'selectors' => [ | |
| 408 | - "{{WRAPPER}} $selector" => 'display: {{VALUE}}', | |
| 409 | - ], | |
| 410 | - ] | |
| 411 | - ), | |
| 412 | - "{$prefix_name}_text_margin" => self::add_responsive_control_type( | |
| 413 | - "{$prefix_name}_text_margin", | |
| 414 | - esc_html__( 'Margin', 'learnpress' ), | |
| 415 | - [], | |
| 416 | - Controls_Manager::DIMENSIONS, | |
| 417 | - [ | |
| 418 | - 'size_units' => [ 'px', '%', 'custom' ], | |
| 419 | - 'selectors' => array( | |
| 420 | - "{{WRAPPER}} $selector" => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 421 | - ), | |
| 422 | - ] | |
| 423 | - ), | |
| 424 | - "{$prefix_name}_text_padding" => self::add_responsive_control_type( | |
| 425 | - "{$prefix_name}_text_padding", | |
| 426 | - esc_html__( 'Padding', 'learnpress' ), | |
| 427 | - [], | |
| 428 | - Controls_Manager::DIMENSIONS, | |
| 429 | - [ | |
| 430 | - 'size_units' => [ 'px', '%', 'custom' ], | |
| 431 | - 'selectors' => array( | |
| 432 | - "{{WRAPPER}} $selector" => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 433 | - ), | |
| 434 | - ] | |
| 435 | - ), | |
| 436 | - "{$prefix_name}_text_typography" => self::add_group_control_type( | |
| 437 | - "{$prefix_name}_typography", | |
| 438 | - Group_Control_Typography::get_type(), | |
| 439 | - "{{WRAPPER}} $selector" | |
| 440 | - ), | |
| 441 | - "{$prefix_name}_text_shadow" => self::add_group_control_type( | |
| 442 | - "{$prefix_name}_shadow", | |
| 443 | - Group_Control_Text_Shadow::get_type(), | |
| 444 | - "{{WRAPPER}} $selector" | |
| 445 | - ), | |
| 446 | - | |
| 447 | - "{$prefix_name}_text_color" => self::add_control_type_color( | |
| 448 | - "{$prefix_name}_text_color", | |
| 449 | - esc_html__( 'Text Color', 'learnpress' ), | |
| 450 | - [ "{{WRAPPER}} $selector" => 'color: {{VALUE}}' ] | |
| 451 | - ), | |
| 452 | - "{$prefix_name}_text_color_hover" => self::add_control_type_color( | |
| 453 | - "{$prefix_name}_text_color_hover", | |
| 454 | - esc_html__( 'Text Color Hover', 'learnpress' ), | |
| 455 | - [ "{{WRAPPER}} $selector:hover" => 'color: {{VALUE}}' ] | |
| 456 | - ), | |
| 457 | - "{$prefix_name}_text_background" => self::add_control_type_color( | |
| 458 | - "{$prefix_name}_text_background", | |
| 459 | - esc_html__( 'Background Color', 'learnpress' ), | |
| 460 | - [ "{{WRAPPER}} $selector" => 'background: {{VALUE}}' ] | |
| 461 | - ), | |
| 462 | - "{$prefix_name}_text_background_hover" => self::add_control_type_color( | |
| 463 | - "{$prefix_name}_text_background_hover", | |
| 464 | - esc_html__( 'Background Color Hover', 'learnpress' ), | |
| 465 | - [ "{{WRAPPER}} $selector:hover" => 'background: {{VALUE}}' ] | |
| 466 | - ), | |
| 467 | - ]; | |
| 468 | - | |
| 469 | - return self::add_group_style_controls( $fields, $prefix_name, $include, $exclude ); | |
| 470 | - } | |
| 471 | - | |
| 472 | - /** | |
| 473 | - * Group control style for button. | |
| 474 | - * | |
| 475 | - * @param string $prefix_name | |
| 476 | - * @param string $selector | |
| 477 | - * @param array $include | |
| 478 | - * @param array $exclude | |
| 479 | - * | |
| 480 | - * @return array | |
| 481 | - */ | |
| 482 | - public static function add_controls_style_button( | |
| 483 | - string $prefix_name, | |
| 484 | - string $selector, | |
| 485 | - array $include = [], | |
| 486 | - array $exclude = [] | |
| 487 | - ): array { | |
| 488 | - | |
| 489 | - $fields = self::add_controls_style_text( $prefix_name, $selector, $include, $exclude ); | |
| 490 | - $fields = array_merge( | |
| 491 | - $fields, | |
| 492 | - [ | |
| 493 | - "{$prefix_name}_btn_border" => self::add_group_control_type( | |
| 494 | - "{$prefix_name}_btn_border", | |
| 495 | - Group_Control_Border::get_type(), | |
| 496 | - "{{WRAPPER}} $selector" | |
| 497 | - ), | |
| 498 | - "{$prefix_name}_btn_border_radius" => self::add_control_type( | |
| 499 | - "{$prefix_name}_btn_border_radius", | |
| 500 | - esc_html__( 'Border Radius', 'learnpress' ), | |
| 501 | - [], | |
| 502 | - Controls_Manager::DIMENSIONS, | |
| 503 | - [ | |
| 504 | - 'size_units' => [ 'px', '%', 'custom' ], | |
| 505 | - 'selectors' => [ | |
| 506 | - "{{WRAPPER}} $selector" => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 507 | - ], | |
| 508 | - ] | |
| 509 | - ), | |
| 510 | - ] | |
| 511 | - ); | |
| 512 | - | |
| 513 | - return self::add_group_style_controls( $fields, $prefix_name, $include, $exclude ); | |
| 514 | - } | |
| 515 | - | |
| 516 | - /** | |
| 517 | - * Group control style for button. | |
| 518 | - * | |
| 519 | - * @param string $prefix_name | |
| 520 | - * @param string $selector | |
| 521 | - * @param array $include | |
| 522 | - * @param array $exclude | |
| 523 | - * | |
| 524 | - * @return array | |
| 525 | - */ | |
| 526 | - public static function add_controls_style_image( | |
| 527 | - string $prefix_name, | |
| 528 | - string $selector, | |
| 529 | - array $include = [], | |
| 530 | - array $exclude = [] | |
| 531 | - ): array { | |
| 532 | - | |
| 533 | - $fields = [ | |
| 534 | - "{$prefix_name}_img_show" => self::add_control_type( | |
| 535 | - "{$prefix_name}_img_show", | |
| 536 | - esc_html__( 'Image', 'learnpress' ), | |
| 537 | - '', | |
| 538 | - Controls_Manager::SWITCHER, | |
| 539 | - [ | |
| 540 | - 'selectors' => [ "{{WRAPPER}} $selector" => 'display: {{VALUE}}' ], | |
| 541 | - 'return_value' => 'none', | |
| 542 | - 'label_on' => esc_html__( 'Hide', 'learnpress' ), | |
| 543 | - 'label_off' => esc_html__( 'Show', 'learnpress' ), | |
| 544 | - ] | |
| 545 | - ), | |
| 546 | - "{$prefix_name}_img_margin" => self::add_responsive_control_type( | |
| 547 | - "{$prefix_name}_img_margin", | |
| 548 | - esc_html__( 'Margin', 'learnpress' ), | |
| 549 | - [], | |
| 550 | - Controls_Manager::DIMENSIONS, | |
| 551 | - [ | |
| 552 | - 'size_units' => [ 'px', '%', 'custom' ], | |
| 553 | - 'selectors' => array( | |
| 554 | - "{{WRAPPER}} $selector" => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 555 | - ), | |
| 556 | - ] | |
| 557 | - ), | |
| 558 | - "{$prefix_name}_img_padding" => self::add_responsive_control_type( | |
| 559 | - "{$prefix_name}_img_padding", | |
| 560 | - esc_html__( 'Padding', 'learnpress' ), | |
| 561 | - [], | |
| 562 | - Controls_Manager::DIMENSIONS, | |
| 563 | - [ | |
| 564 | - 'size_units' => [ 'px', '%', 'custom' ], | |
| 565 | - 'selectors' => array( | |
| 566 | - "{{WRAPPER}} $selector" => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 567 | - ), | |
| 568 | - ] | |
| 569 | - ), | |
| 570 | - "{$prefix_name}_img_border" => self::add_group_control_type( | |
| 571 | - "{$prefix_name}_img_border", | |
| 572 | - Group_Control_Border::get_type(), | |
| 573 | - "{{WRAPPER}} $selector" | |
| 574 | - ), | |
| 575 | - "{$prefix_name}_img_border_radius" => self::add_control_type( | |
| 576 | - "{$prefix_name}_img_border_radius", | |
| 577 | - esc_html__( 'Border Radius', 'learnpress' ), | |
| 578 | - [], | |
| 579 | - Controls_Manager::DIMENSIONS, | |
| 580 | - [ | |
| 581 | - 'size_units' => [ 'px', '%', 'custom' ], | |
| 582 | - 'selectors' => [ | |
| 583 | - "{{WRAPPER}} $selector" => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 584 | - ], | |
| 585 | - ] | |
| 586 | - ), | |
| 587 | - ]; | |
| 588 | - | |
| 589 | - return self::add_group_style_controls( $fields, $prefix_name, $include, $exclude ); | |
| 590 | - } | |
| 591 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Class LP_Elementor_Widgets | |
| 4 | + * | |
| 5 | + * @since 4.2.3 | |
| 6 | + * @version 1.0.1 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace LearnPress\ExternalPlugin\Elementor; | |
| 10 | + | |
| 11 | +use Elementor\Controls_Manager; | |
| 12 | +use Elementor\Group_Control_Border; | |
| 13 | +use Elementor\Group_Control_Text_Shadow; | |
| 14 | +use Elementor\Group_Control_Typography; | |
| 15 | + | |
| 16 | +class LPElementorControls { | |
| 17 | + /** | |
| 18 | + * Start section. | |
| 19 | + * | |
| 20 | + * @param string $id | |
| 21 | + * @param string $label | |
| 22 | + * @param string $tab | |
| 23 | + * @param array $args | |
| 24 | + * | |
| 25 | + * @return string[] | |
| 26 | + */ | |
| 27 | + private static function add_start_section( | |
| 28 | + string $id, | |
| 29 | + string $label, | |
| 30 | + string $tab = Controls_Manager::TAB_CONTENT, | |
| 31 | + array $args = [] | |
| 32 | + ): array { | |
| 33 | + return [ | |
| 34 | + 'method' => 'start_controls_section', | |
| 35 | + 'id' => $id, | |
| 36 | + array_merge( | |
| 37 | + [ | |
| 38 | + 'label' => $label, | |
| 39 | + 'tab' => $tab, | |
| 40 | + ], | |
| 41 | + $args | |
| 42 | + ), | |
| 43 | + ]; | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * Start section. | |
| 48 | + * | |
| 49 | + * @param string $id_section | |
| 50 | + * @param string $label_section | |
| 51 | + * @param string $tab | |
| 52 | + * @param array $fields_inner | |
| 53 | + * @param array $args_section | |
| 54 | + * | |
| 55 | + * @return string[] | |
| 56 | + */ | |
| 57 | + public static function add_fields_in_section( | |
| 58 | + string $id_section, | |
| 59 | + string $label_section, | |
| 60 | + string $tab = Controls_Manager::TAB_CONTENT, | |
| 61 | + array $fields_inner = [], | |
| 62 | + array $args_section = [] | |
| 63 | + ): array { | |
| 64 | + return array_merge( | |
| 65 | + [ | |
| 66 | + "section_$id_section" => LPElementorControls::add_start_section( | |
| 67 | + "section_$id_section", | |
| 68 | + $label_section, | |
| 69 | + $tab, | |
| 70 | + $args_section | |
| 71 | + ), | |
| 72 | + ], | |
| 73 | + $fields_inner, | |
| 74 | + [ "end_section_$id_section" => [ 'method' => 'end_controls_section' ] ] | |
| 75 | + ); | |
| 76 | + } | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Controls Tabs. | |
| 80 | + * | |
| 81 | + * @param string $id | |
| 82 | + * @param array $control_tab_inner | |
| 83 | + * | |
| 84 | + * @return string[] | |
| 85 | + * @since 4.2.3.4 | |
| 86 | + * @version 1.0.0 | |
| 87 | + */ | |
| 88 | + public static function add_start_control_tabs( string $id, array $control_tab_inner = [] ): array { | |
| 89 | + return array_merge( | |
| 90 | + [ | |
| 91 | + 'start_controls_tabs_' . $id => [ | |
| 92 | + 'method' => 'start_controls_tabs', | |
| 93 | + 'id' => $id, | |
| 94 | + ], | |
| 95 | + ], | |
| 96 | + $control_tab_inner, | |
| 97 | + [ 'end_control_tabs_' . $id => [ 'method' => 'end_controls_tabs' ] ] | |
| 98 | + ); | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Controls Tab. | |
| 103 | + * | |
| 104 | + * @param string $id | |
| 105 | + * @param string $label | |
| 106 | + * @param array $controls_inner | |
| 107 | + * | |
| 108 | + * @return string[] | |
| 109 | + * @since 4.2.3.4 | |
| 110 | + * @version 1.0.0 | |
| 111 | + */ | |
| 112 | + public static function add_start_control_tab( string $id, string $label = '', array $controls_inner = [] ): array { | |
| 113 | + return array_merge( | |
| 114 | + [ | |
| 115 | + 'start_controls_tab_' . $id => [ | |
| 116 | + 'method' => 'start_controls_tab', | |
| 117 | + 'id' => $id, | |
| 118 | + [ | |
| 119 | + 'label' => $label, | |
| 120 | + ], | |
| 121 | + ], | |
| 122 | + ], | |
| 123 | + $controls_inner, | |
| 124 | + [ 'end_controls_tab_' . $id => [ 'method' => 'end_controls_tab' ] ] | |
| 125 | + ); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * Declare control type. | |
| 130 | + * | |
| 131 | + * @param string $id | |
| 132 | + * @param string $control_type | |
| 133 | + * @param string $label | |
| 134 | + * @param string|array $default | |
| 135 | + * @param array $args | |
| 136 | + * | |
| 137 | + * @return string[] | |
| 138 | + */ | |
| 139 | + public static function add_control_type( | |
| 140 | + string $id, | |
| 141 | + string $label, | |
| 142 | + $default = '', | |
| 143 | + string $control_type = Controls_Manager::TEXT, | |
| 144 | + array $args = [] | |
| 145 | + ): array { | |
| 146 | + return [ | |
| 147 | + 'method' => 'add_control', | |
| 148 | + 'id' => $id, | |
| 149 | + array_merge( | |
| 150 | + [ | |
| 151 | + 'label' => $label, | |
| 152 | + 'type' => $control_type, | |
| 153 | + 'default' => $default, | |
| 154 | + ], | |
| 155 | + $args | |
| 156 | + ), | |
| 157 | + ]; | |
| 158 | + } | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * Responsive control type. | |
| 162 | + * | |
| 163 | + * | |
| 164 | + * @param string $id | |
| 165 | + * @param string $label | |
| 166 | + * @param string|array $default | |
| 167 | + * @param string $control_type | |
| 168 | + * @param array $args | |
| 169 | + * | |
| 170 | + * @return array | |
| 171 | + */ | |
| 172 | + public static function add_responsive_control_type( | |
| 173 | + string $id, | |
| 174 | + string $label, | |
| 175 | + $default = '', | |
| 176 | + string $control_type = Controls_Manager::CHOOSE, | |
| 177 | + array $args = [] | |
| 178 | + ): array { | |
| 179 | + return [ | |
| 180 | + 'method' => 'add_responsive_control', | |
| 181 | + 'id' => $id, | |
| 182 | + array_merge( | |
| 183 | + [ | |
| 184 | + 'label' => $label, | |
| 185 | + 'type' => $control_type, | |
| 186 | + 'default' => $default, | |
| 187 | + ], | |
| 188 | + $args | |
| 189 | + ), | |
| 190 | + ]; | |
| 191 | + } | |
| 192 | + | |
| 193 | + /** | |
| 194 | + * control type select. | |
| 195 | + * | |
| 196 | + * @param string $id | |
| 197 | + * @param string $label | |
| 198 | + * @param array $options | |
| 199 | + * @param $default | |
| 200 | + * @param array $args | |
| 201 | + * | |
| 202 | + * @return string[] | |
| 203 | + */ | |
| 204 | + public static function add_control_type_select( | |
| 205 | + string $id, | |
| 206 | + string $label, | |
| 207 | + array $options, | |
| 208 | + $default, | |
| 209 | + array $args = [] | |
| 210 | + ): array { | |
| 211 | + return self::add_control_type( | |
| 212 | + $id, | |
| 213 | + $label, | |
| 214 | + $default, | |
| 215 | + Controls_Manager::SELECT, | |
| 216 | + array_merge( | |
| 217 | + [ | |
| 218 | + 'options' => $options, | |
| 219 | + ], | |
| 220 | + $args | |
| 221 | + ) | |
| 222 | + ); | |
| 223 | + } | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * control type select. | |
| 227 | + * | |
| 228 | + * @param string $id | |
| 229 | + * @param string $label | |
| 230 | + * @param array $selectors | |
| 231 | + * @param string $default | |
| 232 | + * @param array $args | |
| 233 | + * | |
| 234 | + * @return string[] | |
| 235 | + */ | |
| 236 | + public static function add_control_type_switcher( | |
| 237 | + string $id, | |
| 238 | + string $label, | |
| 239 | + array $selectors = [], | |
| 240 | + string $default = 'no', | |
| 241 | + array $args = [] | |
| 242 | + ): array { | |
| 243 | + return self::add_control_type( | |
| 244 | + $id, | |
| 245 | + $label, | |
| 246 | + $default, | |
| 247 | + Controls_Manager::SWITCHER, | |
| 248 | + array_merge( | |
| 249 | + [ | |
| 250 | + 'selectors' => $selectors, | |
| 251 | + ], | |
| 252 | + $args | |
| 253 | + ) | |
| 254 | + ); | |
| 255 | + } | |
| 256 | + | |
| 257 | + /** | |
| 258 | + * control type color. | |
| 259 | + * | |
| 260 | + * @param string $id | |
| 261 | + * @param string $label | |
| 262 | + * @param array $selector | |
| 263 | + * @param array $args | |
| 264 | + * | |
| 265 | + * @return string[] | |
| 266 | + */ | |
| 267 | + public static function add_control_type_color( string $id, string $label, array $selector, array $args = [] ): array { | |
| 268 | + return self::add_control_type( | |
| 269 | + $id, | |
| 270 | + $label, | |
| 271 | + '', | |
| 272 | + Controls_Manager::COLOR, | |
| 273 | + array_merge( [ 'selectors' => $selector ], $args ) | |
| 274 | + ); | |
| 275 | + } | |
| 276 | + | |
| 277 | + /** | |
| 278 | + * Declare control type slider. | |
| 279 | + * | |
| 280 | + * @param string $id | |
| 281 | + * @param string $label | |
| 282 | + * @param float $default | |
| 283 | + * @param string $unit | |
| 284 | + * @param array $args | |
| 285 | + * | |
| 286 | + * @return string[] | |
| 287 | + */ | |
| 288 | + public static function add_control_type_slider( | |
| 289 | + string $id, | |
| 290 | + string $label, | |
| 291 | + float $default = 0, | |
| 292 | + string $unit = 'px', | |
| 293 | + array $args = [] | |
| 294 | + ): array { | |
| 295 | + return self::add_control_type( | |
| 296 | + $id, | |
| 297 | + $label, | |
| 298 | + $default, | |
| 299 | + Controls_Manager::SLIDER, | |
| 300 | + array_merge( | |
| 301 | + [ | |
| 302 | + 'range' => array( | |
| 303 | + 'px' => array( | |
| 304 | + 'min' => 0, | |
| 305 | + 'max' => 60, | |
| 306 | + 'step' => 1, | |
| 307 | + ), | |
| 308 | + ), | |
| 309 | + 'default' => array( | |
| 310 | + 'size' => $default, | |
| 311 | + 'unit' => $unit, | |
| 312 | + ), | |
| 313 | + ], | |
| 314 | + $args | |
| 315 | + ) | |
| 316 | + ); | |
| 317 | + } | |
| 318 | + | |
| 319 | + /** | |
| 320 | + * Declare control type. | |
| 321 | + * | |
| 322 | + * @param string $id | |
| 323 | + * @param string $group_type | |
| 324 | + * @param string $selector | |
| 325 | + * @param array $args | |
| 326 | + * | |
| 327 | + * @return string[] | |
| 328 | + */ | |
| 329 | + public static function add_group_control_type( string $id, string $group_type, string $selector, array $args = [] ): array { | |
| 330 | + return [ | |
| 331 | + 'method' => 'add_group_control', | |
| 332 | + $group_type, | |
| 333 | + array_merge( | |
| 334 | + [ | |
| 335 | + 'name' => $id, | |
| 336 | + 'selector' => $selector, | |
| 337 | + ], | |
| 338 | + $args | |
| 339 | + ), | |
| 340 | + ]; | |
| 341 | + } | |
| 342 | + | |
| 343 | + /** | |
| 344 | + * Include or exclude more fields. | |
| 345 | + * | |
| 346 | + * @param array $fields | |
| 347 | + * @param string $prefix_name - prefix name of field for exclude. Format: 'prefix_name'_'field_name_want_exclude' | |
| 348 | + * @param array $include - no need prefix_name, must add by standard format: 'prefix_name'_'btn'_'attribute' | |
| 349 | + * @param array $exclude | |
| 350 | + * | |
| 351 | + * @return array | |
| 352 | + */ | |
| 353 | + private static function add_group_style_controls( | |
| 354 | + array $fields, | |
| 355 | + string $prefix_name, | |
| 356 | + array $include = [], | |
| 357 | + array $exclude = [] | |
| 358 | + ): array { | |
| 359 | + | |
| 360 | + if ( ! empty( $include ) ) { | |
| 361 | + $fields = array_merge( $fields, $include ); | |
| 362 | + } | |
| 363 | + | |
| 364 | + if ( ! empty( $exclude ) ) { | |
| 365 | + foreach ( $exclude as $field ) { | |
| 366 | + $field = "{$prefix_name}_{$field}"; | |
| 367 | + unset( $fields[ $field ] ); | |
| 368 | + } | |
| 369 | + } | |
| 370 | + | |
| 371 | + return $fields; | |
| 372 | + } | |
| 373 | + | |
| 374 | + /** | |
| 375 | + * Group control style for text. | |
| 376 | + * | |
| 377 | + * @param string $prefix_name | |
| 378 | + * @param string $selector | |
| 379 | + * @param array $include | |
| 380 | + * @param array $exclude | |
| 381 | + * | |
| 382 | + * @return array | |
| 383 | + */ | |
| 384 | + public static function add_controls_style_text( | |
| 385 | + string $prefix_name, | |
| 386 | + string $selector, | |
| 387 | + array $include = [], | |
| 388 | + array $exclude = [] | |
| 389 | + ): array { | |
| 390 | + $fields = [ | |
| 391 | + "{$prefix_name}_text_display" => self::add_control_type( | |
| 392 | + "{$prefix_name}_text_display", | |
| 393 | + esc_html__( 'Display', 'learnpress' ), | |
| 394 | + 'block', | |
| 395 | + Controls_Manager::CHOOSE, | |
| 396 | + [ | |
| 397 | + 'options' => [ | |
| 398 | + 'block' => array( | |
| 399 | + 'title' => esc_html__( 'Block', 'learnpress' ), | |
| 400 | + 'icon' => 'eicon-editor-list-ul', | |
| 401 | + ), | |
| 402 | + 'inline-block' => array( | |
| 403 | + 'title' => esc_html__( 'Inline', 'learnpress' ), | |
| 404 | + 'icon' => 'eicon-ellipsis-h', | |
| 405 | + ), | |
| 406 | + ], | |
| 407 | + 'selectors' => [ | |
| 408 | + "{{WRAPPER}} $selector" => 'display: {{VALUE}}', | |
| 409 | + ], | |
| 410 | + ] | |
| 411 | + ), | |
| 412 | + "{$prefix_name}_text_margin" => self::add_responsive_control_type( | |
| 413 | + "{$prefix_name}_text_margin", | |
| 414 | + esc_html__( 'Margin', 'learnpress' ), | |
| 415 | + [], | |
| 416 | + Controls_Manager::DIMENSIONS, | |
| 417 | + [ | |
| 418 | + 'size_units' => [ 'px', '%', 'custom' ], | |
| 419 | + 'selectors' => array( | |
| 420 | + "{{WRAPPER}} $selector" => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 421 | + ), | |
| 422 | + ] | |
| 423 | + ), | |
| 424 | + "{$prefix_name}_text_padding" => self::add_responsive_control_type( | |
| 425 | + "{$prefix_name}_text_padding", | |
| 426 | + esc_html__( 'Padding', 'learnpress' ), | |
| 427 | + [], | |
| 428 | + Controls_Manager::DIMENSIONS, | |
| 429 | + [ | |
| 430 | + 'size_units' => [ 'px', '%', 'custom' ], | |
| 431 | + 'selectors' => array( | |
| 432 | + "{{WRAPPER}} $selector" => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 433 | + ), | |
| 434 | + ] | |
| 435 | + ), | |
| 436 | + "{$prefix_name}_text_typography" => self::add_group_control_type( | |
| 437 | + "{$prefix_name}_typography", | |
| 438 | + Group_Control_Typography::get_type(), | |
| 439 | + "{{WRAPPER}} $selector" | |
| 440 | + ), | |
| 441 | + "{$prefix_name}_text_shadow" => self::add_group_control_type( | |
| 442 | + "{$prefix_name}_shadow", | |
| 443 | + Group_Control_Text_Shadow::get_type(), | |
| 444 | + "{{WRAPPER}} $selector" | |
| 445 | + ), | |
| 446 | + | |
| 447 | + "{$prefix_name}_text_color" => self::add_control_type_color( | |
| 448 | + "{$prefix_name}_text_color", | |
| 449 | + esc_html__( 'Text Color', 'learnpress' ), | |
| 450 | + [ "{{WRAPPER}} $selector" => 'color: {{VALUE}}' ] | |
| 451 | + ), | |
| 452 | + "{$prefix_name}_text_color_hover" => self::add_control_type_color( | |
| 453 | + "{$prefix_name}_text_color_hover", | |
| 454 | + esc_html__( 'Text Color Hover', 'learnpress' ), | |
| 455 | + [ "{{WRAPPER}} $selector:hover" => 'color: {{VALUE}}' ] | |
| 456 | + ), | |
| 457 | + "{$prefix_name}_text_background" => self::add_control_type_color( | |
| 458 | + "{$prefix_name}_text_background", | |
| 459 | + esc_html__( 'Background Color', 'learnpress' ), | |
| 460 | + [ "{{WRAPPER}} $selector" => 'background: {{VALUE}}' ] | |
| 461 | + ), | |
| 462 | + "{$prefix_name}_text_background_hover" => self::add_control_type_color( | |
| 463 | + "{$prefix_name}_text_background_hover", | |
| 464 | + esc_html__( 'Background Color Hover', 'learnpress' ), | |
| 465 | + [ "{{WRAPPER}} $selector:hover" => 'background: {{VALUE}}' ] | |
| 466 | + ), | |
| 467 | + ]; | |
| 468 | + | |
| 469 | + return self::add_group_style_controls( $fields, $prefix_name, $include, $exclude ); | |
| 470 | + } | |
| 471 | + | |
| 472 | + /** | |
| 473 | + * Group control style for button. | |
| 474 | + * | |
| 475 | + * @param string $prefix_name | |
| 476 | + * @param string $selector | |
| 477 | + * @param array $include | |
| 478 | + * @param array $exclude | |
| 479 | + * | |
| 480 | + * @return array | |
| 481 | + */ | |
| 482 | + public static function add_controls_style_button( | |
| 483 | + string $prefix_name, | |
| 484 | + string $selector, | |
| 485 | + array $include = [], | |
| 486 | + array $exclude = [] | |
| 487 | + ): array { | |
| 488 | + | |
| 489 | + $fields = self::add_controls_style_text( $prefix_name, $selector, $include, $exclude ); | |
| 490 | + $fields = array_merge( | |
| 491 | + $fields, | |
| 492 | + [ | |
| 493 | + "{$prefix_name}_btn_border" => self::add_group_control_type( | |
| 494 | + "{$prefix_name}_btn_border", | |
| 495 | + Group_Control_Border::get_type(), | |
| 496 | + "{{WRAPPER}} $selector" | |
| 497 | + ), | |
| 498 | + "{$prefix_name}_btn_border_radius" => self::add_control_type( | |
| 499 | + "{$prefix_name}_btn_border_radius", | |
| 500 | + esc_html__( 'Border Radius', 'learnpress' ), | |
| 501 | + [], | |
| 502 | + Controls_Manager::DIMENSIONS, | |
| 503 | + [ | |
| 504 | + 'size_units' => [ 'px', '%', 'custom' ], | |
| 505 | + 'selectors' => [ | |
| 506 | + "{{WRAPPER}} $selector" => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 507 | + ], | |
| 508 | + ] | |
| 509 | + ), | |
| 510 | + ] | |
| 511 | + ); | |
| 512 | + | |
| 513 | + return self::add_group_style_controls( $fields, $prefix_name, $include, $exclude ); | |
| 514 | + } | |
| 515 | + | |
| 516 | + /** | |
| 517 | + * Group control style for button. | |
| 518 | + * | |
| 519 | + * @param string $prefix_name | |
| 520 | + * @param string $selector | |
| 521 | + * @param array $include | |
| 522 | + * @param array $exclude | |
| 523 | + * | |
| 524 | + * @return array | |
| 525 | + */ | |
| 526 | + public static function add_controls_style_image( | |
| 527 | + string $prefix_name, | |
| 528 | + string $selector, | |
| 529 | + array $include = [], | |
| 530 | + array $exclude = [] | |
| 531 | + ): array { | |
| 532 | + | |
| 533 | + $fields = [ | |
| 534 | + "{$prefix_name}_img_show" => self::add_control_type( | |
| 535 | + "{$prefix_name}_img_show", | |
| 536 | + esc_html__( 'Image', 'learnpress' ), | |
| 537 | + '', | |
| 538 | + Controls_Manager::SWITCHER, | |
| 539 | + [ | |
| 540 | + 'selectors' => [ "{{WRAPPER}} $selector" => 'display: {{VALUE}}' ], | |
| 541 | + 'return_value' => 'none', | |
| 542 | + 'label_on' => esc_html__( 'Hide', 'learnpress' ), | |
| 543 | + 'label_off' => esc_html__( 'Show', 'learnpress' ), | |
| 544 | + ] | |
| 545 | + ), | |
| 546 | + "{$prefix_name}_img_margin" => self::add_responsive_control_type( | |
| 547 | + "{$prefix_name}_img_margin", | |
| 548 | + esc_html__( 'Margin', 'learnpress' ), | |
| 549 | + [], | |
| 550 | + Controls_Manager::DIMENSIONS, | |
| 551 | + [ | |
| 552 | + 'size_units' => [ 'px', '%', 'custom' ], | |
| 553 | + 'selectors' => array( | |
| 554 | + "{{WRAPPER}} $selector" => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 555 | + ), | |
| 556 | + ] | |
| 557 | + ), | |
| 558 | + "{$prefix_name}_img_padding" => self::add_responsive_control_type( | |
| 559 | + "{$prefix_name}_img_padding", | |
| 560 | + esc_html__( 'Padding', 'learnpress' ), | |
| 561 | + [], | |
| 562 | + Controls_Manager::DIMENSIONS, | |
| 563 | + [ | |
| 564 | + 'size_units' => [ 'px', '%', 'custom' ], | |
| 565 | + 'selectors' => array( | |
| 566 | + "{{WRAPPER}} $selector" => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 567 | + ), | |
| 568 | + ] | |
| 569 | + ), | |
| 570 | + "{$prefix_name}_img_border" => self::add_group_control_type( | |
| 571 | + "{$prefix_name}_img_border", | |
| 572 | + Group_Control_Border::get_type(), | |
| 573 | + "{{WRAPPER}} $selector" | |
| 574 | + ), | |
| 575 | + "{$prefix_name}_img_border_radius" => self::add_control_type( | |
| 576 | + "{$prefix_name}_img_border_radius", | |
| 577 | + esc_html__( 'Border Radius', 'learnpress' ), | |
| 578 | + [], | |
| 579 | + Controls_Manager::DIMENSIONS, | |
| 580 | + [ | |
| 581 | + 'size_units' => [ 'px', '%', 'custom' ], | |
| 582 | + 'selectors' => [ | |
| 583 | + "{{WRAPPER}} $selector" => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 584 | + ], | |
| 585 | + ] | |
| 586 | + ), | |
| 587 | + ]; | |
| 588 | + | |
| 589 | + return self::add_group_style_controls( $fields, $prefix_name, $include, $exclude ); | |
| 590 | + } | |
| 591 | +} | |