# You must use a tab-size of 4 spaces to edit this file.
---
plugin_settings:
    module_class_name: zenario_twig_snippet
    tabs:
        first_tab:
            label: 'Twig code'
            notices:
                no_snippets_found:
                    type: error
                    show: true
                    visible_if: |
                        _.isEmpty(lib.field('twig_snippet').values)
                    html: true
                    message: >
                        No Twig snippets were found.
                        To make a Twig snippet, create a file with an extension <code>.twig.html</code>,
                        and place it in the directory <code>zenario_custom/twig/</code>.
                        (You should create this directory if it doesn't exist.)
            fields:
                twig_snippet:
                    ord: html - 0.02
                    plugin_setting:
                        name: twig_snippet
                    label: 'Twig snippet:'
                    type: select
                    empty_value: " -- Select -- "
                    validation:
                        required: Please select a Twig snippet
                    format_onchange: true
                    side_note: "Select a snippet to view file contents in the box below."
                twig_path:
                    ord: html - 0.01
                    indent: 1
                    #row_class: zenario_fbInfo zenario_fbInfo_small
                    snippet:
                        label: ''
                html:
                    plugin_setting: {}
                    label: 'Twig code:'
                    type: code_editor
                    readonly: true
                    tall_as_possible: true
                    style: |
                        width: 99%;
                    value: ""
                    dont_trim: true
                    language: twig
                vars:
                    ord: html + 0.01
                    plugin_setting:
                        name: vars
                    label: 'Variables:'
                    tooltip: |
                        Declare any variables that should be passed to the Twig script.
                        Must use valid YAML syntax and have a space after each colon, e.g. "key: value".
                    type: code_editor
                    value: |
                        variableName1: value1
                        variableName2: value2
                    language: yaml
                    style: >
                        height: 5em;
                        width: 99%;
        caching:
            label: Plugin caching
            fields:
                cache:
                    plugin_setting:
                        name: cache
                    type: select
                    empty_value: Don't use the cache
                    values:
                        safely:
                            label: Use the cache safely (recommended)
                        maximise:
                            label: Maximise usage of the cache (advanced)
                    redraw_onchange: true
                if_user_logged_in:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: if_user_logged_in
                    label: Allow caching when extranet users are logged in
                    side_note: |
                        If you display information about the current user,
                        you should not allow your plugin to be cached when an extranet user is logged in,
                        otherwise users will see information from other users.
                    type: checkbox
                if_get_or_post_var_set:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: if_get_or_post_var_set
                    label: Allow caching when there are additional GET parameters or a POST request
                    side_note: |
                        If your code uses a variable from the GET or POST requests,
                        you should not allow it to be cached when there is a variable in the GET or POST requests.
                        Variables that Zenario uses (e.g. <code>cID</code>, <code>cType</code>) are excluded from this logic.
                    type: checkbox
                if_session_var_or_cookie_set:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: if_session_var_or_cookie_set
                    label: Allow caching when there is a cookie or session variable
                    side_note: |
                        If your code uses a variable from the visitor's SESSION or a cookie,
                        you should not allow it to be cached when there is a variable in the visitor's SESSION or the visitor has a cookie set.
                        Variables that Zenario uses are excluded from this logic.
                    type: checkbox
                
                clear_by_content:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: clear_by_content
                    label: Clear the cache when a published content item is changed
                    side_note: |
                        Check this option if you display data from a content item, e.g. its title.
                    type: checkbox
                    value: 1
                clear_by_menu:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: clear_by_menu
                    label: Clear the cache when the menu is changed
                    side_note: |
                        Check this option if you display data from a menu node, e.g. its name or path.
                    type: checkbox
                    value: 1
                clear_by_file:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: clear_by_file
                    label: Clear the cache when a file, image or its meta-data is changed
                    side_note: |
                        Check this option if you display an image or download link, or data from a file, e.g. it's name or size.
                    type: checkbox
                    value: 1
                clear_by_module:
                    visible_if: |
                        zenarioAB.value('cache') == 'maximise'
                    indent: 1
                    plugin_setting:
                        name: clear_by_module
                    label: Clear the cache when data is added/updated/deleted by a module
                    side_note: |
                        Check this option if you display any information from a module's database tables.
                    type: checkbox
                    value: 1
