# Deprecated Notice Control

Elementor Core Basic

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.

When using this control, the type should be set to \Elementor\Controls_Manager::DEPRECATED_NOTICE constant.

# Arguments

NameTypeDefaultDescription
typestringraw_htmlThe type of the control.
labelstringThe label that appears above of the field.
show_labelbooltrueWhether to display the label.
label_blockboolfalseWhether to display the label in a separate line.
separatorstringdefaultSet the position of the control separator. Available values are default, before and after. default will hide the separator, unless the control type has specific separator settings. before / after will position the separator before/after the control.
widgetstringThe widget name.
sincestringPlugin version in which the widget was deprecated.
laststringPlugin version in which the widget will be removed.
pluginstringPlugin’s title.
replacementstringWidget replacement.

# Return Value

This control does not return any value.

# Usage

There are two ways to add deprecation notice to widgets:

# Using the Regular Add Control

Add a notice warning that the widget is deprecated using the regular add_control() method.














 
 
 
 
 
 
 
 
 
 
 
 









<?php
class Elementor_Test_Widget extends \Elementor\Widget_Base {

	protected function register_controls(): void {

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

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

		// Register the rest of the controls as usual.

		$this->end_controls_section();

	}

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

# Using a Deprecated Notice Method

Add a notice warning that the widget is deprecated using the deprecated_notice() method.














 
 
 
 
 
 








<?php
class Elementor_Test_Widget extends \Elementor\Widget_Base {

	protected function register_controls(): void {

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

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

		// Register the rest of the controls as usual.

		$this->end_controls_section();

	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26