diff --git a/.github/workflows/add-prs-to-project.yml b/.github/workflows/add-prs-to-project.yml new file mode 100644 index 000000000..2d3f41ada --- /dev/null +++ b/.github/workflows/add-prs-to-project.yml @@ -0,0 +1,22 @@ +name: Add new PRs to github project + +on: + pull_request_target: + types: + - opened + - ready_for_review + +permissions: {} + +jobs: + addprtoproject: + name: Add PR to GitHub Project + # Only run on the silverstripe account + if: github.repository_owner == 'silverstripe' + runs-on: ubuntu-latest + steps: + - name: Add PR to github project + uses: silverstripe/gha-add-pr-to-project@v1 + with: + app_id: ${{ vars.PROJECT_PERMISSIONS_APP_ID }} + private_key: ${{ secrets.PROJECT_PERMISSIONS_APP_PRIVATE_KEY }} diff --git a/code/SiteConfig.php b/code/SiteConfig.php index 29c310b27..111d1cf6d 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); @@ -277,8 +277,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; @@ -327,7 +327,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); @@ -345,7 +345,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"); } @@ -500,13 +500,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