title: "CSS 滤镜组控件" post_status: publish comment_status: open taxonomy: category: - elementor-developers-docs post_tag: - Editor Controls - Src - Repos


CSS 滤镜组控件

Elementor CSS 滤镜组控件显示滑块字段,用于定义不同 CSS 滤镜的值,包括模糊、亮度、对比度、饱和度或色调。

该控件在 Group_Control_Css_Filter 类中定义,该类继承自 Group_Control_Base 类。

使用此组控件时,type 应设置为 Group_Control_Typography::get_type() 方法。

参数

名称 类型 默认值 描述
type string typography 控件的类型。
separator string default 设置控件分隔符的位置。可用值为 defaultbeforeafterdefault 将隐藏分隔符,除非控件类型有特定的分隔符设置。before / after 会将分隔符定位在控件之前/之后。
exclude array 从组控件中排除某些控件。示例:['saturate']

返回值

(array) 包含 CSS 滤镜值的数组。

用法

```php {14-20,29-31,37-39}

start_controls_section( 'content_section', [ 'label' => esc_html__( 'Content', 'textdomain' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_group_control( \Elementor\Group_Control_Css_Filter::get_type(), [ 'name' => 'custom_css_filters', 'selector' => '{{WRAPPER}} .your-class', ] ); $this->end_controls_section(); } protected function render(): void { $settings = $this->get_settings_for_display(); ?>
    <div class="your-class">
        ...
    </div>
    <?php
}

protected function content_template(): void {
    ?>
    <div class="your-class">
        ...
    </div>
    <?php
}

} ```