mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
MINOR added language dropdown to subsite (from r84567)
This commit is contained in:
parent
4be67533d4
commit
f9a95055cb
@ -21,9 +21,10 @@ class Subsite extends DataObject implements PermissionProvider {
|
|||||||
'RedirectURL' => 'Varchar(255)',
|
'RedirectURL' => 'Varchar(255)',
|
||||||
'DefaultSite' => 'Boolean',
|
'DefaultSite' => 'Boolean',
|
||||||
'Theme' => 'Varchar',
|
'Theme' => 'Varchar',
|
||||||
|
'Language' => 'Varchar(6)',
|
||||||
|
|
||||||
// Used to hide unfinished/private subsites from public view.
|
// Used to hide unfinished/private subsites from public view.
|
||||||
// If unset, will default to
|
// If unset, will default to true
|
||||||
'IsPublic' => 'Boolean'
|
'IsPublic' => 'Boolean'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -142,6 +143,8 @@ class Subsite extends DataObject implements PermissionProvider {
|
|||||||
array("Domain" => "Domain (use * as a wildcard)", "IsPrimary" => "Primary domain?"),
|
array("Domain" => "Domain (use * as a wildcard)", "IsPrimary" => "Primary domain?"),
|
||||||
array("Domain" => "TextField", "IsPrimary" => "CheckboxField"),
|
array("Domain" => "TextField", "IsPrimary" => "CheckboxField"),
|
||||||
"SubsiteID", $this->ID);
|
"SubsiteID", $this->ID);
|
||||||
|
|
||||||
|
$languageSelector = new DropdownField('Language', 'Language', i18n::get_common_languages());
|
||||||
|
|
||||||
$fields = new FieldSet(
|
$fields = new FieldSet(
|
||||||
new TabSet('Root',
|
new TabSet('Root',
|
||||||
@ -151,6 +154,7 @@ class Subsite extends DataObject implements PermissionProvider {
|
|||||||
|
|
||||||
new HeaderField("Domains for this subsite"),
|
new HeaderField("Domains for this subsite"),
|
||||||
$domainTable,
|
$domainTable,
|
||||||
|
$languageSelector,
|
||||||
// new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL),
|
// new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL),
|
||||||
new CheckboxField('DefaultSite', 'Default site', $this->DefaultSite),
|
new CheckboxField('DefaultSite', 'Default site', $this->DefaultSite),
|
||||||
new CheckboxField('IsPublic', 'Enable public access', $this->IsPublic),
|
new CheckboxField('IsPublic', 'Enable public access', $this->IsPublic),
|
||||||
@ -251,6 +255,13 @@ JS;
|
|||||||
|
|
||||||
Session::set('SubsiteID', (int)$subsiteID);
|
Session::set('SubsiteID', (int)$subsiteID);
|
||||||
|
|
||||||
|
// Set locale
|
||||||
|
if (is_object($subsite) && $subsite->Language != '') {
|
||||||
|
if (isset(i18n::$likely_subtags[$subsite->Language])) {
|
||||||
|
i18n::set_locale(i18n::$likely_subtags[$subsite->Language]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Only bother flushing caches if we've actually changed
|
// Only bother flushing caches if we've actually changed
|
||||||
if($subsiteID != self::currentSubsiteID()) {
|
if($subsiteID != self::currentSubsiteID()) {
|
||||||
Permission::flush_permission_cache();
|
Permission::flush_permission_cache();
|
||||||
|
Loading…
Reference in New Issue
Block a user