{% extends "_layouts/cp" %} {% set fullPageForm = true %} {% import "_includes/forms" as forms %} {% block content %} {{ actionInput('sites/save-site') }} {{ redirectInput('settings/sites') }} {% if site.id %}{{ hiddenInput('siteId', site.id) }}{% endif %} {{ forms.selectField({ first: true, label: "Group"|t('app'), instructions: "Which group should this site belong to?"|t('app'), warning: site.id and craft.app.isMultiSite ? 'Changing this may result in data loss.'|t('app'), id: 'group', name: 'group', options: groupOptions, value: groupId }) }}
{{ forms.autosuggestField({ first: true, label: "Name"|t('app'), instructions: "What this site will be called in the control panel."|t('app'), id: 'name', name: 'name', value: site.originalName ?? site.getName(false), suggestEnvVars: true, errors: site.getErrors('name'), autofocus: true, required: true, }) }} {{ forms.textField({ label: "Handle"|t('app'), instructions: "How you’ll refer to this site in the templates."|t('app'), id: 'handle', name: 'handle', class: 'code', autocorrect: false, autocapitalize: false, value: site.handle, errors: site.getErrors('handle'), required: true }) }} {% if not craft.app.i18n.getIsIntlLoaded() %} {% set languageWarning = 'Enable the [Intl extension]({link1}) or install additional [locale data files]({link2}) for more language options.'|t('app', { link1: 'https://php.net/manual/en/book.intl.php', link2: 'https://github.com/craftcms/locales' }) %} {% endif %} {{ forms.selectField({ label: "Language"|t('app'), instructions: "The language content in this site will use."|t('app'), id: 'language', name: 'language', value: site.language, options: languageOptions, errors: site.getErrors('language'), warning: languageWarning ?? null }) }} {% if (craft.app.isMultiSite or not site.id) and not site.primary %} {{ forms.lightswitchField({ label: 'Make this the primary site'|t('app'), instructions: "The primary site will be loaded by default on the front end."|t('app'), id: 'primary', name: 'primary', on: site.primary }) }} {% else %} {{ hiddenInput('primary', '1') }} {% endif %}
{{ forms.checkboxField({ label: "This site has its own base URL"|t('app'), id: 'has-urls', name: 'hasUrls', checked: site.hasUrls, toggle: 'url-settings' }) }}
{{ forms.autosuggestField({ label: "Base URL"|t('app'), instructions: "The base URL for the site."|t('app'), id: 'base-url', class: 'ltr', suggestEnvVars: true, suggestAliases: true, name: 'baseUrl', value: site.originalBaseUrl ?? site.getBaseUrl(false), errors: site.getErrors('baseUrl') }) }}
{% endblock %} {% block details %} {% if (craft.app.isMultiSite or not site.id) %}
{{ forms.lightswitchField({ label: 'Enabled'|t('app'), id: 'enabled', name: 'enabled', on: site.primary or site.enabled, disabled: site.primary, instructions: site.primary ? 'The primary site cannot be disabled.'|t('app') : null, errors: site.getErrors('enabled'), }) }}
{% endif %} {% endblock %} {% if not site.handle %} {% js on ready %} new Craft.HandleGenerator('#name', '#handle'); {% endjs %} {% endif %}