{% macro warning(key, file) -%} {%- set configArray = craft.app.config.getConfigFromFile(file) -%} {%- if configArray[key] is defined -%} {{- "This is being overridden by the `#{ key }` setting in the `config/#{ file }.php` file."|raw }} {%- endif -%} {%- endmacro %} {% extends '_layouts/cp.twig' %} {% import '_includes/forms.twig' as forms %} {% set title = 'Announce' %} {% set fullPageForm = true %} {% set configFileName = "announce" %} {% set bannerTabClass = settings.getErrors('bannerLink') ? 'error' : '' %} {% set modalTabClass = settings.getErrors('linkButtonUrl') or settings.getErrors('buttonRedirectUrl') ? 'error' : '' %} {% set tabs = { 'banner': { label: 'Banner'|t('announce'), url: '#announce-alert', class: bannerTabClass }, 'modal': { label: 'Modal'|t('announce'), url: '#announce-modal', class: modalTabClass }, } %} {% set crumbs = [ { url: 'announce', label: 'Announce' } ] %} {% set additionalButtons %} {{ "Preview Login Modal"|t('announce') }} {% endset %} {% block content %} {{ actionInput('announce/settings/save-settings') }}
{{ "The alert banner will display your announcement at the top of the admin panel."|t('announce') }}
{{ forms.lightswitchField({ label: 'Enabled'|t('announce'), name: 'bannerEnabled', on: config.bannerEnabled ?? settings.bannerEnabled ?? "", warning: _self.warning('bannerEnabled', configFileName) }) }}{{ "The main announcement message for the alert banner."|t('announce') }}
{{ forms.textField({ label: 'Banner Text'|t('announce'), name: 'bannerText', instructions: 'Banner does not show if blank.'|t('announce'), value: config.bannerText ?? settings.bannerText, warning: _self.warning('bannerText', configFileName) }) }}{{ "Link the user to more information or any URL."|t('announce') }}
{{ forms.textField({ label: 'Banner Link Text'|t('announce'), name: 'bannerLinkText', value: config.bannerLinkText ?? settings.bannerLinkText, instructions: 'Button does not show if blank.'|t('announce'), warning: _self.warning('bannerLinkText', configFileName) }) }} {{ forms.textField({ label: 'Banner Link URL'|t('announce'), name: 'bannerLink', value: config.bannerLink ?? settings.bannerLink, instructions: 'Opens in new tab. \n Button does not show if blank.'|t('announce'), warning: _self.warning('bannerLink', configFileName), errors: settings.getErrors('bannerLink') }) }}{{ "The login modal will display your announcement when users log in to the admin panel."|t('announce') }}
{{ forms.lightswitchField({ label: 'Enabled'|t('announce'), name: 'modalEnabled', on: config.modalEnabled ?? settings.modalEnabled ?? "", warning: _self.warning('modalEnabled', configFileName) }) }}{{ "Link the user to more information or any URL."|t('announce') }}
{{ forms.textField({ label: 'Link Button Text'|t('announce'), name: 'linkButtonText', value: config.linkButtonText ?? settings.linkButtonText, instructions: 'Button does not show if blank.'|t('announce'), warning: _self.warning('linkButtonText', configFileName) }) }} {{ forms.textField({ label: 'Link Button URL'|t('announce'), name: 'linkButtonUrl', value: config.linkButtonUrl ?? settings.linkButtonUrl, instructions: 'Opens in new tab. \n Button does not show if blank.'|t('announce'), warning: _self.warning('linkButtonUrl', configFileName), errors: settings.getErrors('linkButtonUrl') }) }}{{ "The user will click this to dismiss the modal announcement and continue to the admin panel."|t('announce') }}
{{ forms.textField({ label: 'Button Text'|t('announce'), name: 'buttonText', value: config.buttonText ?? settings.buttonText, placeholder: 'Continue', warning: _self.warning('buttonText', configFileName) }) }} {{ forms.textField({ label: 'Button Redirect URL'|t('announce'), name: 'buttonRedirectUrl', value: config.buttonRedirectUrl ?? settings.buttonRedirectUrl, instructions: 'Redirect URL when the login modal button is clicked. \n Leave blank to use default behaviour.'|t('announce'), warning: _self.warning('buttonRedirectUrl', configFileName), errors: settings.getErrors('buttonRedirectUrl') }) }}