Merge pull request #417 from creative-commoners/pulls/2.3/default-automatic-protocol

FIX Domains now default to "Automatic" protocol, and have the correct help description
This commit is contained in:
Robbie Averill 2019-05-31 11:59:54 +12:00 committed by GitHub
commit 9ee451f706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -47,13 +47,14 @@ en:
SilverStripe\Subsites\Model\SubsiteDomain: SilverStripe\Subsites\Model\SubsiteDomain:
DOMAIN: Domain DOMAIN: Domain
DOMAIN_DESCRIPTION: 'Hostname of this subsite (exclude protocol). Allows wildcards (*).' DOMAIN_DESCRIPTION: 'Hostname of this subsite (exclude protocol). Allows wildcards (*).'
ISPRIMARY_DESCRIPTION: 'Mark this as the default domain for this subsite'
IS_PRIMARY: 'Is Primary Domain?' IS_PRIMARY: 'Is Primary Domain?'
PLURALNAME: 'Subsite Domains' PLURALNAME: 'Subsite Domains'
PLURALS: PLURALS:
one: 'A Subsite Domain' one: 'A Subsite Domain'
other: '{count} Subsite Domains' other: '{count} Subsite Domains'
PROTOCOL_AUTOMATIC: Automatic PROTOCOL_AUTOMATIC: Automatic
PROTOCOL_DESCRIPTION: 'Mark this as the default domain for this subsite' PROTOCOL_DESCRIPTION: 'When generating links to this subsite, use the selected protocol. <br />Selecting ''Automatic'' means subsite links will default to the current protocol.'
PROTOCOL_HTTP: 'http://' PROTOCOL_HTTP: 'http://'
PROTOCOL_HTTPS: 'https://' PROTOCOL_HTTPS: 'https://'
Protocol: Protocol Protocol: Protocol

View File

@ -111,13 +111,14 @@ class SubsiteDomain extends DataObject
self::PROTOCOL_HTTPS => _t(__CLASS__ . '.PROTOCOL_HTTPS', 'https://'), self::PROTOCOL_HTTPS => _t(__CLASS__ . '.PROTOCOL_HTTPS', 'https://'),
self::PROTOCOL_AUTOMATIC => _t(__CLASS__ . '.PROTOCOL_AUTOMATIC', 'Automatic') self::PROTOCOL_AUTOMATIC => _t(__CLASS__ . '.PROTOCOL_AUTOMATIC', 'Automatic')
]; ];
$fields = new FieldList( $fields = FieldList::create(
WildcardDomainField::create('Domain', $this->fieldLabel('Domain'), null, 255) WildcardDomainField::create('Domain', $this->fieldLabel('Domain'), null, 255)
->setDescription(_t( ->setDescription(_t(
__CLASS__ . '.DOMAIN_DESCRIPTION', __CLASS__ . '.DOMAIN_DESCRIPTION',
'Hostname of this subsite (exclude protocol). Allows wildcards (*).' 'Hostname of this subsite (exclude protocol). Allows wildcards (*).'
)), )),
OptionsetField::create('Protocol', $this->fieldLabel('Protocol'), $protocols) OptionsetField::create('Protocol', $this->fieldLabel('Protocol'), $protocols)
->setValue($this->Protocol ?: self::PROTOCOL_AUTOMATIC)
->setDescription(_t( ->setDescription(_t(
__CLASS__ . '.PROTOCOL_DESCRIPTION', __CLASS__ . '.PROTOCOL_DESCRIPTION',
'When generating links to this subsite, use the selected protocol. <br />' . 'When generating links to this subsite, use the selected protocol. <br />' .
@ -125,7 +126,7 @@ class SubsiteDomain extends DataObject
)), )),
CheckboxField::create('IsPrimary', $this->fieldLabel('IsPrimary')) CheckboxField::create('IsPrimary', $this->fieldLabel('IsPrimary'))
->setDescription(_t( ->setDescription(_t(
__CLASS__ . '.PROTOCOL_DESCRIPTION', __CLASS__ . '.ISPRIMARY_DESCRIPTION',
'Mark this as the default domain for this subsite' 'Mark this as the default domain for this subsite'
)) ))
); );