zenario__modules:
    panels:
        plugins:
            refiners: 
                email_address_setting:
                    table_join: |
                        [[DB_PREFIX]]plugin_settings ps
                        ON pi.id = ps.instance_id
                    sql: |
                        (
                            ps.is_email_address = 1 
                            OR 
                            (
                                (ps.is_email_address IS NULL) AND (ps.name LIKE '%email%')
                            )
                        )
                        AND 
                            ps.value != ''
                        AND 
                            ps.is_content = 'synchronized_setting'
                        AND
                            ps.value REGEXP '[^@ ]+@[^. ]+(\\.[^.]+)+'
            columns:
                plugin_email_address:
                    title: Email
                    db_column: |
                        (
                           SELECT GROUP_CONCAT(DISTINCT ps1.value SEPARATOR ', ')
                           FROM [[DB_PREFIX]]plugin_settings ps1
                           WHERE ps1.instance_id = pi.id
                           AND
                           (
                                ps1.is_email_address = 1 
                                OR 
                                (
                                    (ps1.is_email_address IS NULL) AND (ps1.name LIKE '%email%')
                                )
                            )
                            AND 
                                ps1.value != ''
                            AND 
                                ps1.is_content = 'synchronized_setting'
                            AND
                                ps1.value REGEXP '[^@ ]+@[^. ]+(\\.[^.]+)+'
                            
                        )
                    width: xxlarge
                    ord: 100
                    show_by_default: true