Elementor 开发者文档

title: "使用控件" post_status: publish comment_status: open taxonomy: category: - elementor-developers-docs post_tag: - Editor Controls - Src - Repos


使用控件

控件可以在 Elementor 小部件或 Elementor 面板中使用。最终用户使用控件来选择他们的数据。这些数据保存在数据库中,随后用于根据用户的选择生成自定义输出。

注册控件

在您的小部件类中,可以在 register_controls() 方法内添加控件,如下所示:

class Elementor_Test_Widget extends \Elementor\Widget_Base {

    protected function register_controls(): void {

        $this->start_controls_section();

        $this->add_control();

        $this->add_responsive_control();

        $this->add_group_control();

        $this->end_controls_section();

    }

}

可用的控件类型

Elementor 有三种可以添加到小部件的控件类型

Elementor 还有控件的 UI 包装器,可用于对控件进行分组和重新排列:

控件方法

Elementor 控件有一个用于注册设置字段的单一方法。控件的 UI 包装器有两个/四个方法来包装其他控件。

可用的方法: