Hidden Control

Elementor hidden control adds a hidden input field to the panel. It used to save additional data in the database without a visual presentation in the panel.

The control is defined in Control_Hidden class which extends Base_Data_Control class.

Note that when using the control, the type should be set using the \Elementor\Controls_Manager::HIDDEN constant.

Arguments

Name Type Default Description
type string hidden The type of the control.
label string The label that appears above of the field. But in this case it won’t be displayed.
default string The field default value.

Return Value

(string) The hidden field value.

Usage

<?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(
			'view',
			[
				'label' => __( 'View', 'plugin-domain' ),
				'type' => \Elementor\Controls_Manager::HIDDEN,
				'default' => 'traditional',
			]
		);

		$this->end_controls_section();

	}

	protected function render() {
		$settings = $this->get_settings_for_display();
		echo $settings['view'];
	}

	protected function _content_template() {
		?>
		{{{ settings.view }}}
		<?php
	}


}