Skip to content

Popover Toggle Control

Elementor Core BasicPopover Toggle Control

Elementor popover toggle control displays a toggle button to open and close a popover. The control allow you to open a popover with custom controls.

Acvite Popover Toggle Control

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

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

Arguments

NameTypeDefaultDescription
typestringpopover_toggleThe type of the control.
labelstringThe label that appears above of the field.
descriptionstringThe description that appears below 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.
label_onstringCustomThe label for the “unchecked” state.
label_offstringDefaultThe label for the “checked” state.
return_valuestringyesThe value returned when checked.
defaultstringThe field default value.

Return Value

(string) The popover toggle field value, based on return_value argument.

Usage

php
<?php
class Elementor_Test_Widget extends \Elementor\Widget_Base {

	protected function register_controls(): void {

		$this->start_controls_section(
			'style_section',
			[
				'label' => esc_html__( 'Style', 'textdomain' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'border_popover_toggle',
			[
				'label' => esc_html__( 'Border', 'textdomain' ),
				'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
				'label_off' => esc_html__( 'Default', 'textdomain' ),
				'label_on' => esc_html__( 'Custom', 'textdomain' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);

		$this->start_popover();

		$this->add_control();

		$this->add_control();

		$this->add_control();

		$this->end_popover();

		$this->end_controls_section();

	}

}