From c7260fbed0124c7afcf75eb99c893b16a7081696 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 5 Jun 2024 16:35:17 +1200 Subject: [PATCH] ENH Use class name instead of self --- code/SiteConfig.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/code/SiteConfig.php b/code/SiteConfig.php index 39fe4dcb3..f1ed78871 100644 --- a/code/SiteConfig.php +++ b/code/SiteConfig.php @@ -80,8 +80,8 @@ class SiteConfig extends DataObject implements PermissionProvider, TemplateGloba public function populateDefaults() { - $this->Title = _t(self::class . '.SITENAMEDEFAULT', "Your Site Name"); - $this->Tagline = _t(self::class . '.TAGLINEDEFAULT', "your tagline here"); + $this->Title = _t(SiteConfig::class . '.SITENAMEDEFAULT', "Your Site Name"); + $this->Tagline = _t(SiteConfig::class . '.TAGLINEDEFAULT', "your tagline here"); // Allow these defaults to be overridden parent::populateDefaults(); @@ -114,17 +114,17 @@ public function getCMSFields() "Root", $tabMain = Tab::create( 'Main', - $titleField = TextField::create("Title", _t(self::class . '.SITETITLE', "Site title")), + $titleField = TextField::create("Title", _t(SiteConfig::class . '.SITETITLE', "Site title")), $taglineField = TextField::create( "Tagline", - _t(self::class . '.SITETAGLINE', "Site Tagline/Slogan") + _t(SiteConfig::class . '.SITETAGLINE', "Site Tagline/Slogan") ) ), $tabAccess = Tab::create( 'Access', $viewersOptionsField = OptionsetField::create( "CanViewType", - _t(self::class . '.VIEWHEADER', "Who can view pages on this site?") + _t(SiteConfig::class . '.VIEWHEADER', "Who can view pages on this site?") ), $viewerGroupsField = ListboxField::create( "ViewerGroups", @@ -137,14 +137,14 @@ public function getCMSFields() ), $viewerMembersField = SearchableMultiDropdownField::create( "ViewerMembers", - _t(self::class . '.VIEWERMEMBERS', "Viewer Users"), + _t(SiteConfig::class . '.VIEWERMEMBERS', "Viewer Users"), Member::get() ) ->setIsLazyLoaded(true) ->setUseSearchContext(true), $editorsOptionsField = OptionsetField::create( "CanEditType", - _t(self::class . '.EDITHEADER', "Who can edit pages on this site?") + _t(SiteConfig::class . '.EDITHEADER', "Who can edit pages on this site?") ), $editorGroupsField = ListboxField::create( "EditorGroups", @@ -157,18 +157,18 @@ public function getCMSFields() ), $editorMembersField = SearchableMultiDropdownField::create( "EditorMembers", - _t(self::class . '.EDITORMEMBERS', "Editor Users"), + _t(SiteConfig::class . '.EDITORMEMBERS', "Editor Users"), Member::get(), ) ->setIsLazyLoaded(true) ->setUseSearchContext(true), $topLevelCreatorsOptionsField = OptionsetField::create( "CanCreateTopLevelType", - _t(self::class . '.TOPLEVELCREATE', "Who can create pages in the root of the site?") + _t(SiteConfig::class . '.TOPLEVELCREATE', "Who can create pages in the root of the site?") ), $topLevelCreatorsGroupsField = ListboxField::create( "CreateTopLevelGroups", - _t(self::class . '.TOPLEVELCREATORGROUPS2', "Top level creator groups") + _t(SiteConfig::class . '.TOPLEVELCREATORGROUPS2', "Top level creator groups") ) ->setSource($groupsMap) ->setAttribute( @@ -177,7 +177,7 @@ public function getCMSFields() ), $topLevelCreatorsMembersField = SearchableMultiDropdownField::create( "CreateTopLevelMembers", - _t(self::class . '.TOPLEVELCREATORUSERS', "Top level creator users"), + _t(SiteConfig::class . '.TOPLEVELCREATORUSERS', "Top level creator users"), Member::get() ) ->setIsLazyLoaded(true) @@ -198,7 +198,7 @@ public function getCMSFields() "Only these groups (choose from list)" ); $viewersOptionsSource[InheritedPermissions::ONLY_THESE_MEMBERS] = _t( - self::class . '.ACCESSONLYTHESEMEMBERS', + SiteConfig::class . '.ACCESSONLYTHESEMEMBERS', "Only these users (choose from list)" ); $viewersOptionsField->setSource($viewersOptionsSource); @@ -229,7 +229,7 @@ public function getCMSFields() "Only these groups (choose from list)" ); $editorsOptionsSource[InheritedPermissions::ONLY_THESE_MEMBERS] = _t( - self::class . '.EDITONLYTHESEMEMBERS', + SiteConfig::class . '.EDITONLYTHESEMEMBERS', "Only these users (choose from list)" ); $editorsOptionsField->setSource($editorsOptionsSource); @@ -291,8 +291,8 @@ public function getCMSFields() ); } - $tabMain->setTitle(_t(self::class . '.TABMAIN', "Main")); - $tabAccess->setTitle(_t(self::class . '.TABACCESS', "Access")); + $tabMain->setTitle(_t(SiteConfig::class . '.TABMAIN', "Main")); + $tabAccess->setTitle(_t(SiteConfig::class . '.TABACCESS', "Access")); $this->extend('updateCMSFields', $fields); return $fields; @@ -341,7 +341,7 @@ public static function current_site_config() { $siteConfig = DataObject::get_one(SiteConfig::class); if (!$siteConfig) { - $siteConfig = self::make_site_config(); + $siteConfig = SiteConfig::make_site_config(); } static::singleton()->extend('updateCurrentSiteConfig', $siteConfig); @@ -359,7 +359,7 @@ public function requireDefaultRecords() $config = DataObject::get_one(SiteConfig::class); if (!$config) { - self::make_site_config(); + SiteConfig::make_site_config(); DB::alteration_message("Added default site config", "created"); } @@ -514,13 +514,13 @@ public function providePermissions() { return [ 'EDIT_SITECONFIG' => [ - 'name' => _t(self::class . '.EDIT_PERMISSION', 'Manage site configuration'), + 'name' => _t(SiteConfig::class . '.EDIT_PERMISSION', 'Manage site configuration'), 'category' => _t( 'SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY', 'Roles and access permissions' ), 'help' => _t( - self::class . '.EDIT_PERMISSION_HELP', + SiteConfig::class . '.EDIT_PERMISSION_HELP', 'Ability to edit global access settings/top-level page permissions.' ), 'sort' => 400