# ==============================================
# FE-Plugin configuration for EXT:dp_cookieconsent
# ==============================================

plugin.tx_dpcookieconsent {
    view {
        templateRootPaths {
            0 = EXT:dp_cookieconsent/Resources/Private/Templates/
            1 = {$plugin.tx_cookieconsent.view.templateRootPath}
        }
         partialRootPaths {
            0 = EXT:dp_cookieconsent/Resources/Private/Partials/
            1 = {$plugin.tx_cookieconsent.view.partialRootPath}
        }
        layoutRootPaths {
            0 = EXT:dp_cookieconsent/Resources/Private/Layouts/
            1 = {$plugin.tx_cookieconsent.view.layoutRootPath}
        }
    }

    settings {
        url = {$plugin.tx_cookieconsent.settings.url}
        target = {$plugin.tx_cookieconsent.settings.target}
        theme = {$plugin.tx_cookieconsent.settings.theme}
        position = {$plugin.tx_cookieconsent.settings.position}
        type = {$plugin.tx_cookieconsent.settings.type}
        revokable = {$plugin.tx_cookieconsent.settings.revokable}
        reloadOnRevoke = {$plugin.tx_cookieconsent.settings.reloadOnRevoke}

        checkboxes {
            statistics = {$plugin.tx_cookieconsent.settings.statistics}
            marketing = {$plugin.tx_cookieconsent.settings.marketing}
        }

        overlay {
            notice = {$plugin.tx_cookieconsent.settings.overlay.notice}
            box {
                background = {$plugin.tx_cookieconsent.settings.overlay.box.background}
                text = {$plugin.tx_cookieconsent.settings.overlay.box.text}
            }
            button {
                background = {$plugin.tx_cookieconsent.settings.overlay.button.background}
                text = {$plugin.tx_cookieconsent.settings.overlay.button.text}
            }
        }

        palette {
            popup {
                background = {$plugin.tx_cookieconsent.settings.palette.popup.background}
                text = {$plugin.tx_cookieconsent.settings.palette.popup.text}
            }
            button {
                background = {$plugin.tx_cookieconsent.settings.palette.button.background}
                text = {$plugin.tx_cookieconsent.settings.palette.button.text}
            }
        }
    }
}


lib.dp_cookieconsent = FLUIDTEMPLATE
lib.dp_cookieconsent {
    file = EXT:dp_cookieconsent/Resources/Private/Layouts/Cookie.html
    templateName = Cookie

    templateRootPaths < plugin.tx_dpcookieconsent.view.templateRootPaths
    partialRootPaths < plugin.tx_dpcookieconsent.view.partialRootPaths
    layoutRootPaths < plugin.tx_dpcookieconsent.view.layoutRootPaths

    settings < plugin.tx_dpcookieconsent.settings

    dataProcessing {
        10 = DirkPersky\DpCookieconsent\DataProcessing\CookieScriptsProcessor
        10 {
            as = dp_cookie_scripts
            pid = {$plugin.tx_cookieconsent.settings.storagePid}
        }
    }
}

page {
    includeCSS {
        dp_cookieconsent = EXT:dp_cookieconsent/Resources/Public/css/dp_cookieconsent.css
    }

    includeJSFooter {
        dp_cookieconsent = EXT:dp_cookieconsent/Resources/Public/JavaScript/dp_cookieconsent.js
    }

    headerData {
        # cs_seo hook
        657 {
            # Modify Google Analytics from CS_SEO
            10 {
                stdWrap.replacement  {
                    10 {
                        search = <script
                        replace = <script data-ignore="1" data-cookieconsent="statistics" type="text/plain"
                    }
                    20 {
                        search = src=
                        replace = data-src=
                    }
                }
            }
        }
        998 = COA
        998 {
            # Modify Google Tag-Manager & Piwiki from CS_SEO
            10 = COA
            10 {
                wrap = <script data-ignore="1" data-cookieconsent="statistics" type="text/plain">|</script>
                required = 1

                10 < page.jsInline.654
            }
        }
    }
    footerData {
        998 = COA
        998 {
            # Add Consent Config to Script
            20 < lib.dp_cookieconsent
        }
    }
}

# Remove Original Google Tag-Manager & Piwiki from CS_SEO
page.jsInline.654 >
