title: "Popover Toggle Control" post_status: publish comment_status: open taxonomy: category: - elementor-developers-docs post_tag: - Editor Controls - Src - Repos


Popover Toggle Control

Popover 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.

参数

名称 类型 默认值 描述
type string popover_toggle 控件的类型。
label string 显示在字段上方的标签。
description string 显示在字段下方的描述。
show_label bool true 是否显示标签。
label_block bool false 是否在单独一行显示标签。
separator string default 设置控件分隔符的位置。可用值为 defaultbeforeafterdefault 将隐藏分隔符,除非控件类型有特定的分隔符设置。before / after 会将分隔符定位在控件之前/之后。
label_on string Custom “未选中”状态的标签。
label_off string Default “选中”状态的标签。
return_value string yes 选中时返回的值。
default string 字段的默认值。

Return Value

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

Usage

```php {14-24,26,34}

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(); } } ``` ?>