Deprecated Notice Control

Elementor Deprecated Notice control displays a pre-formatted notice in the panel, warning that the widget is deprecated and should be replaced. The control is defined in Control_Deprecated_Notice class which extends Base_UI_Control class. Note that when using the control, the type should be set using the \Elementor\Controls_Manager::DEPRECATED_NOTICE constant.

Arguments

Name Type Default Description
type string raw_html The type of the control.
label string The label that appears above of the field.
description string The description that appears below the field.
show_label bool true Whether to display the label.
label_block bool false Whether to display the label in a separate line.
separator string default Set the position of the control separator. Available values are default, before, after and none. default will position the separator depending on the control type. before / after will position the separator before/after the control. none will hide the separator.
widget string The widget name.
since string Plugin version in which the widget was deprecated.
last string Plugin version in which the widget will be removed.
plugin string Plugin’s title.
replacement string Widget replacement.

Return Value

This control does not return any value.

Usage

There are two ways to use this control, either add it like any other control, or use the new method deprecated_notice() added to Elementor\Widget_Base.

1. To add using the built-in method:


<?php

class Elementor_Test_Widget extends \Elementor\Widget_Base {

   // Invoke the method at the beginning or controls registration.
   // Note that the widget title as the name of the deprecated widget.
   protected function _register_controls() {

        $this->deprecated_notice( 'Your Great Plugin', '2.6.0', '3.0.0', 'your-new-widget' );

        //register the rest of the controls, as ususal
    }
}

2. To add like any other control:


<?php

class Elementor_Test_Widget extends \Elementor\Widget_Base {

    protected function _register_controls() {

        $this->start_controls_section(
            'content_section',
            [
                'label' => __( 'Content', 'plugin-name' ),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'deprecated_notice',
            [
                'type' => \Elementor\Controls_Manager::DEPRECATED_NOTICE,
		'widget' => 'your-old-widget',
		'since' => '2.6.0',
		'last' => '3.0.0',
		'plugin' => 'Your Great Plugin',
		'replacement' => 'your-new-widget',
                'content_classes' => 'your-class',
            ]
        );

        $this->end_controls_section();

    }

}

Get The Latest Updates

We have a lot more where that came from! Join 880,651 subscribers who stay ahead of the pack.
By entering your email, you agree to our Terms of Service and Privacy Policy.