| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; | |
| 5 | -use Elementor\Utils; | |
| 6 | - | |
| 7 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 5 | exit; // Exit if accessed directly. |
| 9 | 6 | } |
| 10 | 7 | |
| @@ -19,8 +16,9 @@ | ||
| 19 | 16 | * @since 1.0.0 |
| 20 | 17 | * @abstract |
| 21 | 18 | */ |
| 22 | 19 | abstract class Widget_Base extends Element_Base { |
| 20 | + | |
| 23 | 21 | /** |
| 24 | 22 | * Whether the widget has content. |
| 25 | 23 | * |
| 26 | 24 | * Used in cases where the widget has no content. When widgets uses only |
| @@ -33,24 +31,9 @@ | ||
| 33 | 31 | * @var bool |
| 34 | 32 | */ |
| 35 | 33 | protected $_has_template_content = true; |
| 36 | 34 | |
| 37 | - private $is_first_section = true; | |
| 38 | - | |
| 39 | 35 | /** |
| 40 | - * Registered Runtime Widgets. | |
| 41 | - * | |
| 42 | - * Registering in runtime all widgets that are being used on the page. | |
| 43 | - * | |
| 44 | - * @since 3.3.0 | |
| 45 | - * @access public | |
| 46 | - * @static | |
| 47 | - * | |
| 48 | - * @var array | |
| 49 | - */ | |
| 50 | - public static $registered_runtime_widgets = []; | |
| 51 | - | |
| 52 | - /** | |
| 53 | 36 | * Get element type. |
| 54 | 37 | * |
| 55 | 38 | * Retrieve the element type, in this case `widget`. |
| 56 | 39 | * |
| @@ -106,22 +89,8 @@ | ||
| 106 | 89 | return [ 'general' ]; |
| 107 | 90 | } |
| 108 | 91 | |
| 109 | 92 | /** |
| 110 | - * Get widget upsale data. | |
| 111 | - * | |
| 112 | - * Retrieve the widget promotion data. | |
| 113 | - * | |
| 114 | - * @since 3.18.0 | |
| 115 | - * @access protected | |
| 116 | - * | |
| 117 | - * @return array|null Widget promotion data. | |
| 118 | - */ | |
| 119 | - protected function get_upsale_data() { | |
| 120 | - return null; | |
| 121 | - } | |
| 122 | - | |
| 123 | - /** | |
| 124 | 93 | * Widget base constructor. |
| 125 | 94 | * |
| 126 | 95 | * Initializing the widget base class. |
| 127 | 96 | * |
| @@ -139,9 +108,9 @@ | ||
| 139 | 108 | |
| 140 | 109 | $is_type_instance = $this->is_type_instance(); |
| 141 | 110 | |
| 142 | 111 | if ( ! $is_type_instance && null === $args ) { |
| 143 | - throw new \Exception( 'An `$args` argument is required when initializing a full widget instance.' ); | |
| 112 | + throw new \Exception( '`$args` argument is required when initializing a full widget instance.' ); | |
| 144 | 113 | } |
| 145 | 114 | |
| 146 | 115 | if ( $is_type_instance ) { |
| 147 | 116 | if ( $this->has_own_method( '_register_skins', self::class ) ) { |
| @@ -183,11 +152,11 @@ | ||
| 183 | 152 | */ |
| 184 | 153 | public function get_stack( $with_common_controls = true ) { |
| 185 | 154 | $stack = parent::get_stack(); |
| 186 | 155 | |
| 187 | - if ( $with_common_controls && ! $this instanceof Widget_Common_Base ) { | |
| 188 | - /** @var Widget_Common_Base $common_widget */ | |
| 189 | - $common_widget = Plugin::$instance->widgets_manager->get_widget_types( $this->get_common_widget_name() ); | |
| 156 | + if ( $with_common_controls && 'common' !== $this->get_unique_name() ) { | |
| 157 | + /** @var Widget_Common $common_widget */ | |
| 158 | + $common_widget = Plugin::$instance->widgets_manager->get_widget_types( 'common' ); | |
| 190 | 159 | |
| 191 | 160 | $stack['controls'] = array_merge( $stack['controls'], $common_widget->get_controls() ); |
| 192 | 161 | |
| 193 | 162 | $stack['tabs'] = array_merge( $stack['tabs'], $common_widget->get_tabs_controls() ); |
| @@ -195,16 +164,8 @@ | ||
| 195 | 164 | |
| 196 | 165 | return $stack; |
| 197 | 166 | } |
| 198 | 167 | |
| 199 | - private function get_common_widget_name() { | |
| 200 | - if ( Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) ) { | |
| 201 | - return $this->has_widget_inner_wrapper() ? 'common' : 'common-optimized'; | |
| 202 | - } | |
| 203 | - | |
| 204 | - return 'common'; | |
| 205 | - } | |
| 206 | - | |
| 207 | 168 | /** |
| 208 | 169 | * Get widget controls pointer index. |
| 209 | 170 | * |
| 210 | 171 | * Retrieve widget pointer index where the next control should be added. |
| @@ -241,21 +202,8 @@ | ||
| 241 | 202 | return true; |
| 242 | 203 | } |
| 243 | 204 | |
| 244 | 205 | /** |
| 245 | - * Hide on search. | |
| 246 | - * | |
| 247 | - * Whether to hide the widget on search in the panel or not. By default returns false. | |
| 248 | - * | |
| 249 | - * @access public | |
| 250 | - * | |
| 251 | - * @return bool Whether to hide the widget when searching for widget or not. | |
| 252 | - */ | |
| 253 | - public function hide_on_search() { | |
| 254 | - return false; | |
| 255 | - } | |
| 256 | - | |
| 257 | - /** | |
| 258 | 206 | * Start widget controls section. |
| 259 | 207 | * |
| 260 | 208 | * Used to add a new section of controls to the widget. Regular controls and |
| 261 | 209 | * skin controls. |
| @@ -271,12 +219,14 @@ | ||
| 271 | 219 | */ |
| 272 | 220 | public function start_controls_section( $section_id, array $args = [] ) { |
| 273 | 221 | parent::start_controls_section( $section_id, $args ); |
| 274 | 222 | |
| 275 | - if ( $this->is_first_section ) { | |
| 223 | + static $is_first_section = true; | |
| 224 | + | |
| 225 | + if ( $is_first_section ) { | |
| 276 | 226 | $this->register_skin_control(); |
| 277 | 227 | |
| 278 | - $this->is_first_section = false; | |
| 228 | + $is_first_section = false; | |
| 279 | 229 | } |
| 280 | 230 | } |
| 281 | 231 | |
| 282 | 232 | /** |
| @@ -293,9 +243,9 @@ | ||
| 293 | 243 | if ( ! empty( $skins ) ) { |
| 294 | 244 | $skin_options = []; |
| 295 | 245 | |
| 296 | 246 | if ( $this->_has_template_content ) { |
| 297 | - $skin_options[''] = esc_html__( 'Default', 'elementor' ); | |
| 247 | + $skin_options[''] = __( 'Default', 'elementor' ); | |
| 298 | 248 | } |
| 299 | 249 | |
| 300 | 250 | foreach ( $skins as $skin_id => $skin ) { |
| 301 | 251 | $skin_options[ $skin_id ] = $skin->get_title(); |
| @@ -300,9 +250,9 @@ | ||
| 300 | 250 | foreach ( $skins as $skin_id => $skin ) { |
| 301 | 251 | $skin_options[ $skin_id ] = $skin->get_title(); |
| 302 | 252 | } |
| 303 | 253 | |
| 304 | - // Get the first item for default value. | |
| 254 | + // Get the first item for default value | |
| 305 | 255 | $default_value = array_keys( $skin_options ); |
| 306 | 256 | $default_value = array_shift( $default_value ); |
| 307 | 257 | |
| 308 | 258 | if ( 1 >= count( $skin_options ) ) { |
| @@ -308,9 +258,9 @@ | ||
| 308 | 258 | if ( 1 >= count( $skin_options ) ) { |
| 309 | 259 | $this->add_control( |
| 310 | 260 | '_skin', |
| 311 | 261 | [ |
| 312 | - 'label' => esc_html__( 'Skin', 'elementor' ), | |
| 262 | + 'label' => __( 'Skin', 'elementor' ), | |
| 313 | 263 | 'type' => Controls_Manager::HIDDEN, |
| 314 | 264 | 'default' => $default_value, |
| 315 | 265 | ] |
| 316 | 266 | ); |
| @@ -317,9 +267,9 @@ | ||
| 317 | 267 | } else { |
| 318 | 268 | $this->add_control( |
| 319 | 269 | '_skin', |
| 320 | 270 | [ |
| 321 | - 'label' => esc_html__( 'Skin', 'elementor' ), | |
| 271 | + 'label' => __( 'Skin', 'elementor' ), | |
| 322 | 272 | 'type' => Controls_Manager::SELECT, |
| 323 | 273 | 'default' => $default_value, |
| 324 | 274 | 'options' => $skin_options, |
| 325 | 275 | ] |
| @@ -332,12 +282,12 @@ | ||
| 332 | 282 | * Register widget skins - deprecated prefixed method |
| 333 | 283 | * |
| 334 | 284 | * @since 1.7.12 |
| 335 | 285 | * @access protected |
| 336 | - * @deprecated 3.1.0 Use `register_skins()` method instead. | |
| 286 | + * @deprecated 3.1.0 | |
| 337 | 287 | */ |
| 338 | 288 | protected function _register_skins() { |
| 339 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'register_skins()' ); | |
| 289 | + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', __CLASS__ . '::register_skins()' ); | |
| 340 | 290 | |
| 341 | 291 | $this->register_skins(); |
| 342 | 292 | } |
| 343 | 293 | |
| @@ -378,23 +328,10 @@ | ||
| 378 | 328 | 'keywords' => $this->get_keywords(), |
| 379 | 329 | 'categories' => $this->get_categories(), |
| 380 | 330 | 'html_wrapper_class' => $this->get_html_wrapper_class(), |
| 381 | 331 | 'show_in_panel' => $this->show_in_panel(), |
| 382 | - 'hide_on_search' => $this->hide_on_search(), | |
| 383 | - 'upsale_data' => Plugin::$instance->experiments->is_feature_active( 'e_panel_promotions' ) ? null : $this->get_upsale_data(), | |
| 384 | - 'is_dynamic_content' => $this->is_dynamic_content(), | |
| 385 | - 'has_widget_inner_wrapper' => $this->has_widget_inner_wrapper(), | |
| 386 | 332 | ]; |
| 387 | 333 | |
| 388 | - if ( isset( $config['upsale_data'] ) && is_array( $config['upsale_data'] ) ) { | |
| 389 | - $filter_name = 'elementor/widgets/' . $this->get_name() . '/custom_promotion'; | |
| 390 | - $config['upsale_data'] = Filtered_Promotions_Manager::get_filtered_promotion_data( $config['upsale_data'], $filter_name, 'upgrade_url' ); | |
| 391 | - } | |
| 392 | - | |
| 393 | - if ( isset( $config['upsale_data']['image'] ) ) { | |
| 394 | - $config['upsale_data']['image'] = esc_url( $config['upsale_data']['image'] ); | |
| 395 | - } | |
| 396 | - | |
| 397 | 334 | $stack = Plugin::$instance->controls_manager->get_element_stack( $this ); |
| 398 | 335 | |
| 399 | 336 | if ( $stack ) { |
| 400 | 337 | $config['controls'] = $this->get_stack( false )['controls']; |
| @@ -400,9 +337,9 @@ | ||
| 400 | 337 | $config['controls'] = $this->get_stack( false )['controls']; |
| 401 | 338 | $config['tabs_controls'] = $this->get_tabs_controls(); |
| 402 | 339 | } |
| 403 | 340 | |
| 404 | - return array_replace_recursive( parent::get_initial_config(), $config ); | |
| 341 | + return array_merge( parent::get_initial_config(), $config ); | |
| 405 | 342 | } |
| 406 | 343 | |
| 407 | 344 | /** |
| 408 | 345 | * @since 2.3.1 |
| @@ -423,15 +360,15 @@ | ||
| 423 | 360 | * |
| 424 | 361 | * @param string $template_content Template content. |
| 425 | 362 | */ |
| 426 | 363 | protected function print_template_content( $template_content ) { |
| 427 | - if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 364 | + ?> | |
| 428 | 365 | <div class="elementor-widget-container"> |
| 429 | - <?php endif; | |
| 430 | - Utils::print_unescaped_internal_string( $template_content ); | |
| 431 | - if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 366 | + <?php | |
| 367 | + echo $template_content; // XSS ok. | |
| 368 | + ?> | |
| 432 | 369 | </div> |
| 433 | - <?php endif; | |
| 370 | + <?php | |
| 434 | 371 | } |
| 435 | 372 | |
| 436 | 373 | /** |
| 437 | 374 | * Parse text editor. |
| @@ -461,22 +398,8 @@ | ||
| 461 | 398 | return $content; |
| 462 | 399 | } |
| 463 | 400 | |
| 464 | 401 | /** |
| 465 | - * Safe print parsed text editor. | |
| 466 | - * | |
| 467 | - * @uses static::parse_text_editor. | |
| 468 | - * | |
| 469 | - * @access protected | |
| 470 | - * | |
| 471 | - * @param string $content Text editor content. | |
| 472 | - */ | |
| 473 | - final protected function print_text_editor( $content ) { | |
| 474 | - // PHPCS - the method `parse_text_editor` is safe. | |
| 475 | - echo static::parse_text_editor( $content ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 476 | - } | |
| 477 | - | |
| 478 | - /** | |
| 479 | 402 | * Get HTML wrapper class. |
| 480 | 403 | * |
| 481 | 404 | * Retrieve the widget container class. Can be used to override the |
| 482 | 405 | * container class for specific widgets. |
| @@ -541,17 +464,18 @@ | ||
| 541 | 464 | * |
| 542 | 465 | * Used to add Light-Box-related data attributes to links that open media files. |
| 543 | 466 | * |
| 544 | 467 | * @param array|string $element The link HTML element. |
| 545 | - * @param int $id The ID of the image. | |
| 546 | - * @param string $lightbox_setting_key The setting key that dictates whether to open the image in a lightbox. | |
| 547 | - * @param string $group_id Unique ID for a group of lightbox images. | |
| 548 | - * @param bool $overwrite Optional. Whether to overwrite existing | |
| 549 | - * attribute. Default is false, not to overwrite. | |
| 468 | + * @param int $id The ID of the image | |
| 469 | + * @param string $lightbox_setting_key The setting key that dictates weather to open the image in a lightbox | |
| 470 | + * @param string $group_id Unique ID for a group of lightbox images | |
| 471 | + * @param bool $overwrite Optional. Whether to overwrite existing | |
| 472 | + * attribute. Default is false, not to overwrite. | |
| 550 | 473 | * |
| 551 | 474 | * @return Widget_Base Current instance of the widget. |
| 552 | 475 | * @since 2.9.0 |
| 553 | 476 | * @access public |
| 477 | + * | |
| 554 | 478 | */ |
| 555 | 479 | public function add_lightbox_data_attributes( $element, $id = null, $lightbox_setting_key = null, $group_id = null, $overwrite = false ) { |
| 556 | 480 | $kit = Plugin::$instance->kits_manager->get_active_kit(); |
| 557 | 481 | |
| @@ -570,19 +494,10 @@ | ||
| 570 | 494 | } |
| 571 | 495 | |
| 572 | 496 | $attributes['data-elementor-open-lightbox'] = 'yes'; |
| 573 | 497 | |
| 574 | - $action_hash_params = []; | |
| 575 | - | |
| 576 | - if ( $id ) { | |
| 577 | - $action_hash_params['id'] = $id; | |
| 578 | - $action_hash_params['url'] = wp_get_attachment_url( $id ); | |
| 579 | - } | |
| 580 | - | |
| 581 | 498 | if ( $group_id ) { |
| 582 | 499 | $attributes['data-elementor-lightbox-slideshow'] = $group_id; |
| 583 | - | |
| 584 | - $action_hash_params['slideshow'] = $group_id; | |
| 585 | 500 | } |
| 586 | 501 | |
| 587 | 502 | if ( $id ) { |
| 588 | 503 | $lightbox_image_attributes = Plugin::$instance->images_manager->get_lightbox_image_attributes( $id ); |
| @@ -595,10 +510,8 @@ | ||
| 595 | 510 | $attributes['data-elementor-lightbox-description'] = $lightbox_image_attributes['description']; |
| 596 | 511 | } |
| 597 | 512 | } |
| 598 | 513 | |
| 599 | - $attributes['data-e-action-hash'] = Plugin::instance()->frontend->create_action_hash( 'lightbox', $action_hash_params ); | |
| 600 | - | |
| 601 | 514 | $this->add_render_attribute( $element, $attributes, null, $overwrite ); |
| 602 | 515 | |
| 603 | 516 | return $this; |
| 604 | 517 | } |
| @@ -640,15 +553,11 @@ | ||
| 640 | 553 | |
| 641 | 554 | if ( empty( $widget_content ) ) { |
| 642 | 555 | return; |
| 643 | 556 | } |
| 644 | - if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 557 | + ?> | |
| 645 | 558 | <div class="elementor-widget-container"> |
| 646 | - <?php endif; ?> | |
| 647 | 559 | <?php |
| 648 | - if ( $this->is_widget_first_render( $this->get_group_name() ) ) { | |
| 649 | - $this->register_runtime_widget( $this->get_group_name() ); | |
| 650 | - } | |
| 651 | 560 | |
| 652 | 561 | /** |
| 653 | 562 | * Render widget content. |
| 654 | 563 | * |
| @@ -659,19 +568,15 @@ | ||
| 659 | 568 | * @param string $widget_content The content of the widget. |
| 660 | 569 | * @param Widget_Base $this The widget. |
| 661 | 570 | */ |
| 662 | 571 | $widget_content = apply_filters( 'elementor/widget/render_content', $widget_content, $this ); |
| 663 | - Utils::print_unescaped_internal_string( $widget_content ); | |
| 572 | + | |
| 573 | + echo $widget_content; // XSS ok. | |
| 664 | 574 | ?> |
| 665 | - <?php if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 666 | 575 | </div> |
| 667 | - <?php endif; | |
| 576 | + <?php | |
| 668 | 577 | } |
| 669 | 578 | |
| 670 | - protected function is_widget_first_render( $widget_name ) { | |
| 671 | - return ! in_array( $widget_name, self::$registered_runtime_widgets, true ); | |
| 672 | - } | |
| 673 | - | |
| 674 | 579 | /** |
| 675 | 580 | * Render widget plain content. |
| 676 | 581 | * |
| 677 | 582 | * Elementor saves the page content in a unique way, but it's not the way |
| @@ -696,16 +601,8 @@ | ||
| 696 | 601 | public function render_plain_content() { |
| 697 | 602 | $this->render_content(); |
| 698 | 603 | } |
| 699 | 604 | |
| 700 | - public function render_markdown(): string { | |
| 701 | - ob_start(); | |
| 702 | - $this->render_content(); | |
| 703 | - $html = ob_get_clean(); | |
| 704 | - | |
| 705 | - return wp_strip_all_tags( $html ); | |
| 706 | - } | |
| 707 | - | |
| 708 | 605 | /** |
| 709 | 606 | * Before widget rendering. |
| 710 | 607 | * |
| 711 | 608 | * Used to add stuff before the widget `_wrapper` element. |
| @@ -782,28 +679,8 @@ | ||
| 782 | 679 | $this->render_content(); |
| 783 | 680 | } |
| 784 | 681 | |
| 785 | 682 | /** |
| 786 | - * Print a setting content without escaping. | |
| 787 | - * | |
| 788 | - * Script tags are allowed on frontend according to the WP theme securing policy. | |
| 789 | - * | |
| 790 | - * @param string $setting | |
| 791 | - * @param null $repeater_name | |
| 792 | - * @param null $index | |
| 793 | - */ | |
| 794 | - final public function print_unescaped_setting( $setting, $repeater_name = null, $index = null ) { | |
| 795 | - if ( $repeater_name ) { | |
| 796 | - $repeater = $this->get_settings_for_display( $repeater_name ); | |
| 797 | - $output = $repeater[ $index ][ $setting ]; | |
| 798 | - } else { | |
| 799 | - $output = $this->get_settings_for_display( $setting ); | |
| 800 | - } | |
| 801 | - | |
| 802 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 803 | - } | |
| 804 | - | |
| 805 | - /** | |
| 806 | 683 | * Get default data. |
| 807 | 684 | * |
| 808 | 685 | * Retrieve the default widget data. Used to reset the data on initialization. |
| 809 | 686 | * |
| @@ -855,9 +732,9 @@ | ||
| 855 | 732 | * @access protected |
| 856 | 733 | * |
| 857 | 734 | * @param string $setting_key The current setting key inside the repeater item (e.g. `tab_title`). |
| 858 | 735 | * @param string $repeater_key The repeater key containing the array of all the items in the repeater (e.g. `tabs`). |
| 859 | - * @param int $repeater_item_index The current item index in the repeater array (e.g. `3`). | |
| 736 | + * @param int $repeater_item_index The current item index in the repeater array (e.g. `3`). | |
| 860 | 737 | * |
| 861 | 738 | * @return string The repeater setting key (e.g. `tabs.3.tab_title`). |
| 862 | 739 | */ |
| 863 | 740 | protected function get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ) { |
| @@ -999,33 +876,17 @@ | ||
| 999 | 876 | return Plugin::$instance->skins_manager->get_skins( $this ); |
| 1000 | 877 | } |
| 1001 | 878 | |
| 1002 | 879 | /** |
| 1003 | - * Get group name. | |
| 1004 | - * | |
| 1005 | - * Some widgets need to use group names, this method allows you to create them. | |
| 1006 | - * By default it retrieves the regular name. | |
| 1007 | - * | |
| 1008 | - * @since 3.3.0 | |
| 1009 | - * @access public | |
| 1010 | - * | |
| 1011 | - * @return string Unique name. | |
| 880 | + * @param string $plugin_title Plugin's title | |
| 881 | + * @param string $since Plugin version widget was deprecated | |
| 882 | + * @param string $last Plugin version in which the widget will be removed | |
| 883 | + * @param string $replacement Widget replacement | |
| 1012 | 884 | */ |
| 1013 | - public function get_group_name() { | |
| 1014 | - return $this->get_name(); | |
| 1015 | - } | |
| 1016 | - | |
| 1017 | - /** | |
| 1018 | - * @param string $plugin_title Plugin's title. | |
| 1019 | - * @param string $since Plugin version widget was deprecated. | |
| 1020 | - * @param string $last Plugin version in which the widget will be removed. | |
| 1021 | - * @param string $replacement Widget replacement. | |
| 1022 | - */ | |
| 1023 | 885 | protected function deprecated_notice( $plugin_title, $since, $last = '', $replacement = '' ) { |
| 1024 | - $this->start_controls_section( | |
| 1025 | - 'Deprecated', | |
| 886 | + $this->start_controls_section( 'Deprecated', | |
| 1026 | 887 | [ |
| 1027 | - 'label' => esc_html__( 'Deprecated', 'elementor' ), | |
| 888 | + 'label' => __( 'Deprecated', 'elementor' ), | |
| 1028 | 889 | ] |
| 1029 | 890 | ); |
| 1030 | 891 | |
| 1031 | 892 | $this->add_control( |
| @@ -1040,52 +901,7 @@ | ||
| 1040 | 901 | ] |
| 1041 | 902 | ); |
| 1042 | 903 | |
| 1043 | 904 | $this->end_controls_section(); |
| 1044 | - } | |
| 1045 | 905 | |
| 1046 | - /** | |
| 1047 | - * Init controls. | |
| 1048 | - * | |
| 1049 | - * Reset the `is_first_section` flag to true, so when the Stacks are cleared | |
| 1050 | - * all the controls will be registered again with their skins and settings. | |
| 1051 | - * | |
| 1052 | - * @since 3.14.0 | |
| 1053 | - * @access protected | |
| 1054 | - */ | |
| 1055 | - protected function init_controls() { | |
| 1056 | - $this->is_first_section = true; | |
| 1057 | - parent::init_controls(); | |
| 1058 | - } | |
| 1059 | - | |
| 1060 | - public function register_runtime_widget( $widget_name ) { | |
| 1061 | - self::$registered_runtime_widgets[] = $widget_name; | |
| 1062 | - } | |
| 1063 | - | |
| 1064 | - /** | |
| 1065 | - * Mark widget as deprecated. | |
| 1066 | - * | |
| 1067 | - * Use `get_deprecation_message()` method to print the message control at specific location in register_controls(). | |
| 1068 | - * | |
| 1069 | - * @param string $version The version of Elementor that deprecated the widget. | |
| 1070 | - * @param string $message A message regarding the deprecation. | |
| 1071 | - * @param string $replacement The widget that should be used instead. | |
| 1072 | - */ | |
| 1073 | - protected function add_deprecation_message( $version, $message, $replacement ) { | |
| 1074 | - // Expose the config for handling in JS. | |
| 1075 | - $this->set_config( 'deprecation', [ | |
| 1076 | - 'version' => $version, | |
| 1077 | - 'message' => $message, | |
| 1078 | - 'replacement' => $replacement, | |
| 1079 | - ] ); | |
| 1080 | - | |
| 1081 | - $this->add_control( | |
| 1082 | - 'deprecation_message', | |
| 1083 | - [ | |
| 1084 | - 'type' => Controls_Manager::ALERT, | |
| 1085 | - 'alert_type' => 'info', | |
| 1086 | - 'content' => $message, | |
| 1087 | - 'separator' => 'after', | |
| 1088 | - ] | |
| 1089 | - ); | |
| 1090 | 906 | } |
| 1091 | 907 | } |