跳转到主要内容

标题控件

Elementor 标题控件用于在面板中的控件之间显示文本标题。

该控件定义在继承 Base_UI_Control 类的 Control_Heading 类中。

使用此控件时,应将 type 设置为 \Elementor\Controls_Manager::HEADING 常量。

参数

名称 类型 默认值 描述
type string heading 控件的类型。
label string 显示在字段上方的标签。
show_label bool true 是否显示标签。
label_block bool true 是否在单独一行显示标签。
separator string default 设置控件分隔符的位置。可用值为 default、before 和 after。default 将隐藏分隔符,除非控件类型有特定的分隔符设置。before / after 会将分隔符定位在控件之前/之后。

返回值

此控件不返回任何值。

用法

<?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(
			'more_options',
			[
				'label' => esc_html__( 'Additional Options', 'textdomain' ),
				'type' => \Elementor\Controls_Manager::HEADING,
				'separator' => 'before',
			]
		);

		$this->end_controls_section();

	}

}