From 4c7a068b28f7dc744e342853ea9863ca4882d0cb Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Thu, 3 Aug 2017 15:57:29 +1200 Subject: [PATCH] classes psr2 --- .../05_Dataobject_Relationship_Management.md | 3 +- .../00_Model/01_Data_Model_and_ORM.md | 23 +++--- .../00_Model/02_Relations.md | 74 ++++++++++--------- .../00_Model/04_Data_Types_and_Casting.md | 28 +++---- .../00_Model/05_Extending_DataObjects.md | 8 +- .../00_Model/07_Permissions.md | 4 +- .../00_Model/08_SQL_Select.md | 3 +- .../00_Model/09_Validation.md | 4 +- .../00_Model/10_Versioning.md | 28 ++++--- .../00_Model/11_Scaffolding.md | 40 +++++----- .../00_Model/12_Indexes.md | 8 +- .../01_Templates/09_Casting.md | 8 +- .../02_Controllers/01_Introduction.md | 4 +- .../02_Controllers/03_Access_Control.md | 36 ++++----- .../03_Forms/Field_types/02_DateField.md | 4 +- .../Field_types/03_HTMLEditorField.md | 13 ++-- .../03_Forms/Field_types/04_GridField.md | 24 +++--- .../03_Forms/How_Tos/01_Encapsulate_Forms.md | 12 +-- .../04_Create_a_GridField_ActionProvider.md | 4 +- .../How_Tos/05_Simple_Contact_Form.md | 9 ++- .../04_Configuration/00_Configuration.md | 4 +- .../04_Configuration/01_SiteConfig.md | 4 +- .../05_Extending/01_Extensions.md | 20 ++--- .../05_Extending/04_Shortcodes.md | 4 +- .../05_Extending/05_Injector.md | 17 ++--- .../05_Extending/06_Aspects.md | 4 +- .../How_Tos/03_Track_member_logins.md | 3 +- .../06_Testing/04_Fixtures.md | 8 +- .../How_Tos/01_Write_a_FunctionalTest.md | 4 +- .../06_Testing/How_Tos/02_FixtureFactories.md | 3 +- .../09_Security/00_Member.md | 6 +- .../09_Security/04_Secure_Coding.md | 27 ++++--- .../11_Integration/00_CSV_Import.md | 18 +++-- .../11_Integration/01_RestfulService.md | 8 +- .../11_Integration/02_RSSFeed.md | 12 +-- .../Import_CSV_through_a_Controller.md | 4 +- .../How_Tos/custom_csvbulkloader.md | 12 +-- .../12_Search/01_Searchcontext.md | 12 +-- .../12_Search/02_FulltextSearch.md | 7 +- .../14_Files/01_File_Management.md | 3 +- .../14_Files/03_File_Security.md | 9 ++- .../01_ModelAdmin.md | 44 +++++------ .../02_CMS_Architecture.md | 12 ++- .../06_Javascript_Development.md | 3 +- .../07_ReactJS_Redux_and_GraphQL.md | 7 +- .../How_Tos/Customise_CMS_Menu.md | 10 ++- .../How_Tos/Customise_CMS_Pages_List.md | 9 ++- .../How_Tos/Customise_CMS_Tree.md | 3 +- .../How_Tos/Customise_React_Forms.md | 3 +- .../How_Tos/Customise_Site_Reports.md | 3 +- .../How_Tos/Extend_CMS_Interface.md | 11 +-- .../Extending_An_Existing_ModelAdmin.md | 3 +- .../16_Execution_Pipeline/01_Flushable.md | 6 +- docs/en/02_Developer_Guides/17_CLI/index.md | 4 +- docs/en/04_Changelogs/2.3.2.md | 6 +- docs/en/04_Changelogs/2.4.0.md | 9 ++- docs/en/04_Changelogs/2.4.1.md | 6 +- docs/en/04_Changelogs/2.4.3.md | 15 ++-- docs/en/04_Changelogs/3.0.0.md | 3 +- docs/en/04_Changelogs/3.0.9.md | 3 +- docs/en/04_Changelogs/3.1.0.md | 36 ++++++--- docs/en/04_Changelogs/3.1.11.md | 3 +- docs/en/04_Changelogs/3.1.16.md | 3 +- docs/en/04_Changelogs/3.1.19.md | 3 +- docs/en/04_Changelogs/3.1.2.md | 3 +- docs/en/04_Changelogs/3.1.9.md | 3 +- docs/en/04_Changelogs/3.2.0.md | 3 +- docs/en/04_Changelogs/3.2.1.md | 3 +- docs/en/04_Changelogs/3.2.4.md | 3 +- docs/en/04_Changelogs/3.3.2.md | 3 +- docs/en/04_Changelogs/4.0.0.md | 8 +- docs/en/04_Changelogs/alpha/4.0.0-alpha1.md | 29 +++++--- docs/en/04_Changelogs/beta/3.2.0-beta1.md | 3 +- docs/en/04_Changelogs/rc/3.1.2-rc1.md | 3 +- 74 files changed, 451 insertions(+), 341 deletions(-) diff --git a/docs/en/01_Tutorials/05_Dataobject_Relationship_Management.md b/docs/en/01_Tutorials/05_Dataobject_Relationship_Management.md index 0742ee6b3..2e29fb21f 100644 --- a/docs/en/01_Tutorials/05_Dataobject_Relationship_Management.md +++ b/docs/en/01_Tutorials/05_Dataobject_Relationship_Management.md @@ -115,7 +115,8 @@ The restriction is enforced through the `$allowed_children` directive. ```php use Page; -class ProjectsHolder extends Page { +class ProjectsHolder extends Page +{ private static $allowed_children = [ 'Project' ]; diff --git a/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md b/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md index e06b6f116..384e3c7ae 100644 --- a/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md +++ b/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md @@ -20,8 +20,8 @@ Let's look at a simple example: **mysite/code/Player.php** ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'PlayerNumber' => 'Int', @@ -77,8 +77,8 @@ system. Instead, it will generate a new `ID` by adding 1 to the current maximum **mysite/code/Player.php** ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'PlayerNumber' => 'Int', @@ -570,7 +570,8 @@ For instance, the below model will be stored in the table name `BannerImage` ```php namespace SilverStripe\BannerManager; - class BannerImage extends \DataObject { + class BannerImage extends \DataObject + { private static $table_name = 'BannerImage'; } ``` @@ -660,8 +661,8 @@ Define the default values for all the `$db` fields. This example sets the "Statu whenever a new object is created. ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $defaults = [ "Status" => 'Active', @@ -685,12 +686,12 @@ time. For example, suppose we have the following set of classes: ```php - - class Page extends SiteTree { + class Page extends SiteTree + { } - - class NewsPage extends Page { + class NewsPage extends Page + { private static $db = [ 'Summary' => 'Text' diff --git a/docs/en/02_Developer_Guides/00_Model/02_Relations.md b/docs/en/02_Developer_Guides/00_Model/02_Relations.md index 7103164b6..a52ddf20e 100644 --- a/docs/en/02_Developer_Guides/00_Model/02_Relations.md +++ b/docs/en/02_Developer_Guides/00_Model/02_Relations.md @@ -16,8 +16,8 @@ A 1-to-1 relation creates a database-column called "``ID", in "TeamID" on the "Player"-table. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $db = [ 'Title' => 'Varchar' @@ -27,8 +27,8 @@ A 1-to-1 relation creates a database-column called "``ID", in 'Players' => 'Player' ]; } - - class Player extends DataObject { + class Player extends DataObject + { private static $has_one = [ "Team" => "Team", @@ -75,20 +75,22 @@ To specify that a has_one relation is polymorphic set the type to 'DataObject'. Ideally, the associated has_many (or belongs_to) should be specified with dot notation. ```php - class Player extends DataObject { + class Player extends DataObject + { private static $has_many = [ "Fans" => "Fan.FanOf" ]; } - - class Team extends DataObject { + class Team extends DataObject + { private static $has_many = [ "Fans" => "Fan.FanOf" ]; } // Type of object returned by $fan->FanOf() will vary - class Fan extends DataObject { + class Fan extends DataObject + { // Generates columns FanOfID and FanOfClass private static $has_one = [ @@ -116,8 +118,8 @@ available on both ends. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $db = [ 'Title' => 'Varchar' @@ -127,8 +129,8 @@ available on both ends. 'Players' => 'Player' ]; } - - class Player extends DataObject { + class Player extends DataObject + { private static $has_one = [ "Team" => "Team", @@ -157,16 +159,16 @@ you will get an instance of [HasManyList](api:SilverStripe\ORM\HasManyList) rath To specify multiple `$has_many` to the same object you can use dot notation to distinguish them like below: ```php - - class Person extends DataObject { + class Person extends DataObject + { private static $has_many = [ "Managing" => "Company.Manager", "Cleaning" => "Company.Cleaner", ]; } - - class Company extends DataObject { + class Company extends DataObject + { private static $has_one = [ "Manager" => "Person", @@ -201,15 +203,15 @@ Similarly with `$has_many`, dot notation can be used to explicitly specify the ` This is not mandatory unless the relationship would be otherwise ambiguous. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $has_one = [ 'Coach' => 'Coach' ]; } - - class Coach extends DataObject { + class Coach extends DataObject + { private static $belongs_to = [ 'Team' => 'Team.Coach' @@ -251,8 +253,8 @@ config to add extra columns. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $many_many = [ "Supporters" => "Supporter", ]; @@ -262,8 +264,8 @@ config to add extra columns. ] ]; } - - class Supporter extends DataObject { + class Supporter extends DataObject + { private static $belongs_many_many = [ "Supports" => "Team", @@ -294,8 +296,8 @@ or child record. The syntax for `belongs_many_many` is unchanged. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $many_many = [ "Supporters" => [ 'through' => 'TeamSupporter', @@ -304,14 +306,14 @@ The syntax for `belongs_many_many` is unchanged. ] ]; } - - class Supporter extends DataObject { + class Supporter extends DataObject + { private static $belongs_many_many = [ "Supports" => "Team", ]; } - - class TeamSupporter extends DataObject { + class TeamSupporter extends DataObject + { private static $db = [ 'Ranking' => 'Int', ]; @@ -363,16 +365,16 @@ distinguish them like below: ```php - - class Category extends DataObject { + class Category extends DataObject + { private static $many_many = [ 'Products' => 'Product', 'FeaturedProducts' => 'Product' ]; } - - class Product extends DataObject { + class Product extends DataObject + { private static $belongs_many_many = [ 'Categories' => 'Category.Products', @@ -414,8 +416,8 @@ You can use the ORM to get a filtered result list without writing any SQL. For e See [DataObject::$has_many](api:SilverStripe\ORM\DataObject::$has_many) for more info on the described relations. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $has_many = [ "Players" => "Player" diff --git a/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md b/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md index adbb71b05..f964ab9e2 100644 --- a/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md +++ b/docs/en/02_Developer_Guides/00_Model/04_Data_Types_and_Casting.md @@ -14,8 +14,8 @@ In the `Player` example, we have four database columns each with a different dat **mysite/code/Player.php** ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'PlayerNumber' => 'Int', @@ -53,8 +53,8 @@ For complex default values for newly instantiated objects see [Dynamic Default V For simple values you can make use of the `$defaults` array. For example: ```php - - class Car extends DataObject { + class Car extends DataObject + { private static $db = [ 'Wheels' => 'Int', @@ -84,8 +84,8 @@ For enum values, it's the second parameter. For example: ```php - - class Car extends DataObject { + class Car extends DataObject + { private static $db = [ 'Wheels' => 'Int(4)', @@ -107,8 +107,8 @@ object we can control the formatting and it allows us to call methods defined fr **mysite/code/Player.php** ```php - - class Player extends DataObject { + class Player extends DataObject + { .. @@ -138,8 +138,8 @@ Then we can refer to a new `Name` column on our `Player` instances. In templates Rather than manually returning objects from your custom functions. You can use the `$casting` property. ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $casting = [ "Name" => 'Varchar', @@ -176,8 +176,8 @@ Most objects in SilverStripe extend from [ViewableData](api:SilverStripe\View\Vi context. Through a `$casting` array, arbitrary properties and getters can be casted: ```php - - class MyObject extends ViewableData { + class MyObject extends ViewableData + { private static $casting = [ 'MyDate' => 'Date' @@ -215,8 +215,8 @@ The following example will use the result of `getStatus` instead of the 'Status' database column using `dbObject`. ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ "Status" => "Enum(array('Active', 'Injured', 'Retired'))" diff --git a/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md b/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md index 05318f5e4..137899d4b 100644 --- a/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md +++ b/docs/en/02_Developer_Guides/00_Model/05_Extending_DataObjects.md @@ -19,8 +19,8 @@ a `ModelAdmin` record. Example: Disallow creation of new players if the currently logged-in player is not a team-manager. ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $has_many = [ "Teams"=>"Team" @@ -59,8 +59,8 @@ Example: Checking for a specific [permission](permissions) to delete this type o member is logged in who belongs to a group containing the permission "PLAYER_DELETE". ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $has_many = [ "Teams" => "Team" diff --git a/docs/en/02_Developer_Guides/00_Model/07_Permissions.md b/docs/en/02_Developer_Guides/00_Model/07_Permissions.md index 029f37213..c6c2d2d06 100644 --- a/docs/en/02_Developer_Guides/00_Model/07_Permissions.md +++ b/docs/en/02_Developer_Guides/00_Model/07_Permissions.md @@ -17,8 +17,8 @@ code. ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { public function canView($member = null) { return Permission::check('CMS_ACCESS_CMSMain', 'any', $member); diff --git a/docs/en/02_Developer_Guides/00_Model/08_SQL_Select.md b/docs/en/02_Developer_Guides/00_Model/08_SQL_Select.md index 9972aed36..4914f1d88 100644 --- a/docs/en/02_Developer_Guides/00_Model/08_SQL_Select.md +++ b/docs/en/02_Developer_Guides/00_Model/08_SQL_Select.md @@ -268,7 +268,8 @@ because of the custom SQL value transformation (`YEAR()`). An alternative approach would be a custom getter in the object definition. ```php - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'Name' => 'Varchar', 'Birthdate' => 'Date' diff --git a/docs/en/02_Developer_Guides/00_Model/09_Validation.md b/docs/en/02_Developer_Guides/00_Model/09_Validation.md index 7e4d07c47..f974b8a15 100644 --- a/docs/en/02_Developer_Guides/00_Model/09_Validation.md +++ b/docs/en/02_Developer_Guides/00_Model/09_Validation.md @@ -22,8 +22,8 @@ write, and respond appropriately if it isn't. The return value of `validate()` is a [ValidationResult](api:SilverStripe\ORM\ValidationResult) object. ```php - - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $db = [ 'Country' => 'Varchar', diff --git a/docs/en/02_Developer_Guides/00_Model/10_Versioning.md b/docs/en/02_Developer_Guides/00_Model/10_Versioning.md index 6545db3cf..bddbfb98f 100644 --- a/docs/en/02_Developer_Guides/00_Model/10_Versioning.md +++ b/docs/en/02_Developer_Guides/00_Model/10_Versioning.md @@ -21,7 +21,8 @@ also track versioned history. ```php - class MyStagedModel extends DataObject { + class MyStagedModel extends DataObject + { private static $extensions = [ Versioned::class ]; @@ -33,7 +34,8 @@ can be specified by setting the constructor argument to "Versioned" ```php - class VersionedModel extends DataObject { + class VersionedModel extends DataObject + { private static $extensions = [ "SilverStripe\\ORM\\Versioning\\Versioned('Versioned')" ]; @@ -184,7 +186,8 @@ without requiring any custom code. ```php - class MyPage extends Page { + class MyPage extends Page + { private static $has_many = [ 'Banners' => Banner::class ]; @@ -192,8 +195,8 @@ without requiring any custom code. 'Banners' ]; } - - class Banner extends Page { + class Banner extends Page + { private static $extensions = [ Versioned::class ]; @@ -224,7 +227,8 @@ that can be used to traverse between each, and then by ensuring you configure bo E.g. ```php - class MyParent extends DataObject { + class MyParent extends DataObject + { private static $extensions = [ Versioned::class ]; @@ -235,7 +239,8 @@ E.g. return MyChild::get(); } } - class MyChild extends DataObject { + class MyChild extends DataObject + { private static $extensions = [ Versioned::class ]; @@ -291,7 +296,8 @@ Versioned object visibility can be customised in one of the following ways by ed E.g. ```php - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $extensions = [ Versioned::class, ]; @@ -323,7 +329,8 @@ only be invoked if the object is in a non-published state. E.g. ```php - class MyObjectExtension extends DataExtension { + class MyObjectExtension extends DataExtension + { public function canViewNonLive($member = null) { return Permission::check($member, 'DRAFT_STATUS'); } @@ -336,7 +343,8 @@ permissions in the `TargetObject.non_live_permissions` config. E.g. ```php - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $extensions = [ Versioned::class, ]; diff --git a/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md b/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md index e42f1702b..47dcabb25 100644 --- a/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md +++ b/docs/en/02_Developer_Guides/00_Model/11_Scaffolding.md @@ -13,8 +13,8 @@ customise those fields as required. An example is `DataObject`, SilverStripe will automatically create your CMS interface so you can modify what you need. ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $db = [ 'IsActive' => 'Boolean', @@ -60,8 +60,8 @@ The `$searchable_fields` property uses a mixed array format that can be used to system. The default is a set of array values listing the fields. ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $searchable_fields = [ 'Name', @@ -76,8 +76,8 @@ default search filter assigned (usually an [ExactMatchFilter](api:SilverStripe\O additional information on `$searchable_fields`: ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $searchable_fields = [ 'Name' => 'PartialMatchFilter', @@ -91,8 +91,8 @@ If you assign a single string value, you can set it to be either a [FormField](a both, you can assign an array: ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $searchable_fields = [ 'Name' => [ @@ -112,8 +112,8 @@ both, you can assign an array: To include relations (`$has_one`, `$has_many` and `$many_many`) in your search, you can use a dot-notation. ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $db = [ 'Title' => 'Varchar' @@ -128,8 +128,8 @@ To include relations (`$has_one`, `$has_many` and `$many_many`) in your search, 'Players.Name', ]; } - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'Name' => 'Varchar', @@ -149,8 +149,8 @@ Summary fields can be used to show a quick overview of the data for a specific [ is their display as table columns, e.g. in the search results of a [ModelAdmin](api:SilverStripe\Admin\ModelAdmin) CMS interface. ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $db = [ 'Name' => 'Text', @@ -169,15 +169,15 @@ is their display as table columns, e.g. in the search results of a [ModelAdmin]( To include relations or field manipulations in your summaries, you can use a dot-notation. ```php - - class OtherObject extends DataObject { + class OtherObject extends DataObject + { private static $db = [ 'Title' => 'Varchar' ]; } - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $db = [ 'Name' => 'Text', @@ -200,8 +200,8 @@ To include relations or field manipulations in your summaries, you can use a dot Non-textual elements (such as images and their manipulations) can also be used in summaries. ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $db = [ 'Name' => 'Text' diff --git a/docs/en/02_Developer_Guides/00_Model/12_Indexes.md b/docs/en/02_Developer_Guides/00_Model/12_Indexes.md index c43b5642b..0d5f8efb8 100644 --- a/docs/en/02_Developer_Guides/00_Model/12_Indexes.md +++ b/docs/en/02_Developer_Guides/00_Model/12_Indexes.md @@ -25,8 +25,8 @@ Indexes are represented on a `DataObject` through the `DataObject::$indexes` arr descriptor. There are several supported notations: ```php - - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $indexes = [ '' => true, @@ -53,8 +53,8 @@ support the following: **mysite/code/MyTestObject.php** ```php - - class MyTestObject extends DataObject { + class MyTestObject extends DataObject + { private static $db = [ 'MyField' => 'Varchar', diff --git a/docs/en/02_Developer_Guides/01_Templates/09_Casting.md b/docs/en/02_Developer_Guides/01_Templates/09_Casting.md index a2f9d1457..93fff37cd 100644 --- a/docs/en/02_Developer_Guides/01_Templates/09_Casting.md +++ b/docs/en/02_Developer_Guides/01_Templates/09_Casting.md @@ -48,8 +48,8 @@ provide default template for an object. **mysite/code/Page.php** ```php - - class Page extends SiteTree { + class Page extends SiteTree + { public function forTemplate() { return "Page: ". $this->Title; @@ -71,8 +71,8 @@ content that method sends back, or, provide a type in the `$casting` array for t to a template, SilverStripe will ensure that the object is wrapped in the correct type and values are safely escaped. ```php - - class Page extends SiteTree { + class Page extends SiteTree + { private static $casting = [ 'MyCustomMethod' => 'HTMLText' diff --git a/docs/en/02_Developer_Guides/02_Controllers/01_Introduction.md b/docs/en/02_Developer_Guides/02_Controllers/01_Introduction.md index 9391a5e24..32c701004 100644 --- a/docs/en/02_Developer_Guides/02_Controllers/01_Introduction.md +++ b/docs/en/02_Developer_Guides/02_Controllers/01_Introduction.md @@ -9,8 +9,8 @@ subclass the base `Controller` class. **mysite/code/controllers/TeamController.php** ```php - - class TeamController extends Controller { + class TeamController extends Controller + { private static $allowed_actions = [ 'players', diff --git a/docs/en/02_Developer_Guides/02_Controllers/03_Access_Control.md b/docs/en/02_Developer_Guides/02_Controllers/03_Access_Control.md index b1a142b02..4c8515d8d 100644 --- a/docs/en/02_Developer_Guides/02_Controllers/03_Access_Control.md +++ b/docs/en/02_Developer_Guides/02_Controllers/03_Access_Control.md @@ -12,8 +12,8 @@ Any action you define on a controller must be defined in a `$allowed_actions` st directly calling methods that they shouldn't. ```php - - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = [ // someaction can be accessed by anyone, any time @@ -47,8 +47,8 @@ is specifically restricted. ```php ```php - - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = []; diff --git a/docs/en/02_Developer_Guides/03_Forms/Field_types/02_DateField.md b/docs/en/02_Developer_Guides/03_Forms/Field_types/02_DateField.md index 13b85d655..36ec00f1f 100644 --- a/docs/en/02_Developer_Guides/03_Forms/Field_types/02_DateField.md +++ b/docs/en/02_Developer_Guides/03_Forms/Field_types/02_DateField.md @@ -16,8 +16,8 @@ The following example will add a simple DateField to your Page, allowing you to ```php - - class Page extends SiteTree { + class Page extends SiteTree + { private static $db = [ 'MyDate' => 'Date', diff --git a/docs/en/02_Developer_Guides/03_Forms/Field_types/03_HTMLEditorField.md b/docs/en/02_Developer_Guides/03_Forms/Field_types/03_HTMLEditorField.md index ee51b4114..c0f2cd646 100644 --- a/docs/en/02_Developer_Guides/03_Forms/Field_types/03_HTMLEditorField.md +++ b/docs/en/02_Developer_Guides/03_Forms/Field_types/03_HTMLEditorField.md @@ -17,8 +17,8 @@ functionality. It is usually added through the [DataObject::getCMSFields()](api: ```php - - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $db = [ 'Content' => 'HTMLText' @@ -46,7 +46,8 @@ This is particularly useful if you need different configurations for multiple [H ```php - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $db = [ 'Content' => 'HTMLText', 'OtherContent' => 'HTMLText' @@ -244,7 +245,8 @@ Example: Remove field for "image captions" ```php // File: mysite/code/MyToolbarExtension.php - class MyToolbarExtension extends Extension { + class MyToolbarExtension extends Extension + { public function updateFieldsForImage(&$fields, $url, $file) { $fields->removeByName('CaptionText'); } @@ -284,7 +286,8 @@ of the CMS you have to take care of instantiate yourself: ```php // File: mysite/code/MyController.php - class MyObjectController extends Controller { + class MyObjectController extends Controller + { public function Modals() { return ModalController::create($this, "Modals"); } diff --git a/docs/en/02_Developer_Guides/03_Forms/Field_types/04_GridField.md b/docs/en/02_Developer_Guides/03_Forms/Field_types/04_GridField.md index 08f0d45b3..9d59373da 100644 --- a/docs/en/02_Developer_Guides/03_Forms/Field_types/04_GridField.md +++ b/docs/en/02_Developer_Guides/03_Forms/Field_types/04_GridField.md @@ -29,8 +29,8 @@ actions such as deleting records. ```php - - class Page extends SiteTree { + class Page extends SiteTree + { public function getCMSFields() { $fields = parent::getCMSFields(); @@ -61,8 +61,8 @@ the `getConfig()` method on `GridField`. ```php - - class Page extends SiteTree { + class Page extends SiteTree + { public function getCMSFields() { $fields = parent::getCMSFields(); @@ -269,8 +269,8 @@ The namespace notation is `ManyMany[]`, so for example `Ma ```php - - class Team extends DataObject { + class Team extends DataObject + { private static $db = [ 'Name' => 'Text' @@ -280,8 +280,8 @@ The namespace notation is `ManyMany[]`, so for example `Ma 'Players' => 'Player' ]; } - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'Name' => 'Text' @@ -352,8 +352,8 @@ create an area rendered before the table wrapped in a simple `
`. ```php - - class MyAreaComponent implements GridField_HTMLProvider { + class MyAreaComponent implements GridField_HTMLProvider + { public function getHTMLFragments( $gridField) { return [ @@ -374,8 +374,8 @@ Now you can add other components into this area by returning them as an array fr ```php - - class MyShareLinkComponent implements GridField_HTMLProvider { + class MyShareLinkComponent implements GridField_HTMLProvider + { public function getHTMLFragments( $gridField) { return [ diff --git a/docs/en/02_Developer_Guides/03_Forms/How_Tos/01_Encapsulate_Forms.md b/docs/en/02_Developer_Guides/03_Forms/How_Tos/01_Encapsulate_Forms.md index 1afdbe983..717489dae 100644 --- a/docs/en/02_Developer_Guides/03_Forms/How_Tos/01_Encapsulate_Forms.md +++ b/docs/en/02_Developer_Guides/03_Forms/How_Tos/01_Encapsulate_Forms.md @@ -11,8 +11,8 @@ code for a `Form` is to create it as a subclass to `Form`. Let's look at a examp ```php - - class PageController extends ContentController { + class PageController extends ContentController + { public function SearchForm() { $fields = new FieldList( @@ -69,8 +69,8 @@ should be. Good practice would be to move this to a subclass and create a new in ```php - - class SearchForm extends Form { + class SearchForm extends Form + { /** * Our constructor only requires the controller and the name of the form @@ -131,8 +131,8 @@ Our controller will now just have to create a new instance of this form object. ```php - - class PageController extends ContentController { + class PageController extends ContentController + { private static $allowed_actions = [ 'SearchForm', diff --git a/docs/en/02_Developer_Guides/03_Forms/How_Tos/04_Create_a_GridField_ActionProvider.md b/docs/en/02_Developer_Guides/03_Forms/How_Tos/04_Create_a_GridField_ActionProvider.md index 4ef92130d..391e9b346 100644 --- a/docs/en/02_Developer_Guides/03_Forms/How_Tos/04_Create_a_GridField_ActionProvider.md +++ b/docs/en/02_Developer_Guides/03_Forms/How_Tos/04_Create_a_GridField_ActionProvider.md @@ -19,8 +19,8 @@ below: ```php - - class GridFieldCustomAction implements GridField_ColumnProvider, GridField_ActionProvider { + class GridFieldCustomAction implements GridField_ColumnProvider, GridField_ActionProvider + { public function augmentColumns($gridField, &$columns) { if(!in_array('Actions', $columns)) { diff --git a/docs/en/02_Developer_Guides/03_Forms/How_Tos/05_Simple_Contact_Form.md b/docs/en/02_Developer_Guides/03_Forms/How_Tos/05_Simple_Contact_Form.md index 742d856c2..f20e8a6f7 100644 --- a/docs/en/02_Developer_Guides/03_Forms/How_Tos/05_Simple_Contact_Form.md +++ b/docs/en/02_Developer_Guides/03_Forms/How_Tos/05_Simple_Contact_Form.md @@ -6,9 +6,11 @@ Let's start by defining a new `ContactPage` page type: ```php - class ContactPage extends Page { + class ContactPage extends Page + { } - class ContactPageController extends PageController { + class ContactPageController extends PageController + { private static $allowed_actions = ['Form']; public function Form() { $fields = new FieldList( @@ -70,7 +72,8 @@ Now that we have a contact form, we need some way of collecting the data submitt ```php - class ContactPageController extends PageController { + class ContactPageController extends PageController + { private static $allowed_actions = ['Form']; public function Form() { // ... diff --git a/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md b/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md index feb223c82..c5472b490 100644 --- a/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md +++ b/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md @@ -29,8 +29,8 @@ be marked `private static` and follow the `lower_case_with_underscores` structur ```php - - class MyClass extends Page { + class MyClass extends Page + { /** * @config diff --git a/docs/en/02_Developer_Guides/04_Configuration/01_SiteConfig.md b/docs/en/02_Developer_Guides/04_Configuration/01_SiteConfig.md index 5adcbb007..33dacf3d3 100644 --- a/docs/en/02_Developer_Guides/04_Configuration/01_SiteConfig.md +++ b/docs/en/02_Developer_Guides/04_Configuration/01_SiteConfig.md @@ -40,8 +40,8 @@ To extend the options available in the panel, define your own fields via a [Data ```php - - class CustomSiteConfig extends DataExtension { + class CustomSiteConfig extends DataExtension + { private static $db = [ 'FooterContent' => 'HTMLText' diff --git a/docs/en/02_Developer_Guides/05_Extending/01_Extensions.md b/docs/en/02_Developer_Guides/05_Extending/01_Extensions.md index 47404c2b7..7247e2817 100644 --- a/docs/en/02_Developer_Guides/05_Extending/01_Extensions.md +++ b/docs/en/02_Developer_Guides/05_Extending/01_Extensions.md @@ -19,8 +19,8 @@ and `RequestHandler`. You can still apply extensions to descendants of these cla ```php - - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { private static $db = [ 'DateOfBirth' => 'SS_Datetime' @@ -79,8 +79,8 @@ $has_one etc. ```php - - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { private static $db = [ 'Position' => 'Varchar', @@ -158,8 +158,8 @@ validator by defining the `updateValidator` method. ```php - - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { // .. @@ -179,8 +179,8 @@ extension. The `CMS` provides a `updateCMSFields` Extension Hook to tie into. ```php - - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { private static $db = [ 'Position' => 'Varchar', @@ -225,8 +225,8 @@ In your [Extension](api:SilverStripe\Core\Extension) class you can only refer to ```php - - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { public function updateFoo($foo) { // outputs the original class diff --git a/docs/en/02_Developer_Guides/05_Extending/04_Shortcodes.md b/docs/en/02_Developer_Guides/05_Extending/04_Shortcodes.md index da1d96068..af89deff1 100644 --- a/docs/en/02_Developer_Guides/05_Extending/04_Shortcodes.md +++ b/docs/en/02_Developer_Guides/05_Extending/04_Shortcodes.md @@ -50,8 +50,8 @@ First we need to define a callback for the shortcode. ```php - - class Page extends SiteTree { + class Page extends SiteTree + { private static $casting = [ 'MyShortCodeMethod' => 'HTMLText' diff --git a/docs/en/02_Developer_Guides/05_Extending/05_Injector.md b/docs/en/02_Developer_Guides/05_Extending/05_Injector.md index bcf80a136..53bd26f76 100644 --- a/docs/en/02_Developer_Guides/05_Extending/05_Injector.md +++ b/docs/en/02_Developer_Guides/05_Extending/05_Injector.md @@ -69,9 +69,8 @@ The `Injector` API can be used to define the types of `$dependencies` that an ob ```php - - - class MyController extends Controller { + class MyController extends Controller + { // both of these properties will be automatically // set by the injector on object creation @@ -177,8 +176,8 @@ An example using the `MyFactory` service to create instances of the `MyService` ```php - - class MyFactory implements SilverStripe\Core\Injector\Factory { + class MyFactory implements SilverStripe\Core\Injector\Factory + { public function create($service, array $params = []) { return new MyServiceImplementation(); @@ -213,16 +212,16 @@ Assuming a class structure such as ```php - - class RestrictivePermissionService { + class RestrictivePermissionService + { private $database; public function setDatabase($d) { $this->database = $d; } } - - class MySQLDatabase { + class MySQLDatabase + { private $username; private $password; diff --git a/docs/en/02_Developer_Guides/05_Extending/06_Aspects.md b/docs/en/02_Developer_Guides/05_Extending/06_Aspects.md index d4e370e1f..bf37ba0cf 100644 --- a/docs/en/02_Developer_Guides/05_Extending/06_Aspects.md +++ b/docs/en/02_Developer_Guides/05_Extending/06_Aspects.md @@ -47,8 +47,8 @@ used. ```php - - class MySQLWriteDbAspect implements BeforeCallAspect { + class MySQLWriteDbAspect implements BeforeCallAspect + { /** * @var MySQLDatabase diff --git a/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md b/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md index e183b3176..bddb6cc7b 100644 --- a/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md +++ b/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md @@ -11,7 +11,8 @@ explicitly logging in or by invoking the "remember me" functionality. ```php - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { private static $db = [ 'LastVisited' => 'Datetime', 'NumVisit' => 'Int', diff --git a/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md b/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md index 1745a107e..9715dde6a 100644 --- a/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md +++ b/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md @@ -16,8 +16,8 @@ To include your fixture file in your tests, you should define it as your `$fixtu ```php - - class MyNewTest extends SapphireTest { + class MyNewTest extends SapphireTest + { protected static $fixture_file = 'fixtures.yml'; @@ -31,8 +31,8 @@ You can also use an array of fixture files, if you want to use parts of multiple ```php - - class MyNewTest extends SapphireTest { + class MyNewTest extends SapphireTest + { protected static $fixture_file = [ 'fixtures.yml', diff --git a/docs/en/02_Developer_Guides/06_Testing/How_Tos/01_Write_a_FunctionalTest.md b/docs/en/02_Developer_Guides/06_Testing/How_Tos/01_Write_a_FunctionalTest.md index 210904c41..53db45eef 100644 --- a/docs/en/02_Developer_Guides/06_Testing/How_Tos/01_Write_a_FunctionalTest.md +++ b/docs/en/02_Developer_Guides/06_Testing/How_Tos/01_Write_a_FunctionalTest.md @@ -11,8 +11,8 @@ response and modify the session within a test. ```php - - class HomePageTest extends FunctionalTest { + class HomePageTest extends FunctionalTest + { /** * Test generation of the view diff --git a/docs/en/02_Developer_Guides/06_Testing/How_Tos/02_FixtureFactories.md b/docs/en/02_Developer_Guides/06_Testing/How_Tos/02_FixtureFactories.md index 1e2c54fb2..93f03ed05 100644 --- a/docs/en/02_Developer_Guides/06_Testing/How_Tos/02_FixtureFactories.md +++ b/docs/en/02_Developer_Guides/06_Testing/How_Tos/02_FixtureFactories.md @@ -10,7 +10,8 @@ with information that we need. ```php - class MyObjectTest extends SapphireTest { + class MyObjectTest extends SapphireTest + { protected $factory; diff --git a/docs/en/02_Developer_Guides/09_Security/00_Member.md b/docs/en/02_Developer_Guides/09_Security/00_Member.md index 7c1c2afa5..7fd7a424b 100644 --- a/docs/en/02_Developer_Guides/09_Security/00_Member.md +++ b/docs/en/02_Developer_Guides/09_Security/00_Member.md @@ -49,7 +49,8 @@ You can define subclasses of [Member](api:SilverStripe\Security\Member) to add e ```php - class MyMember extends Member { + class MyMember extends Member + { private static $db = [ "Age" => "Int", "Address" => "Text", @@ -114,7 +115,8 @@ things, you should add appropriate [Permission::checkMember()](api:SilverStripe\ ```php - class MyMemberExtension extends DataExtension { + class MyMemberExtension extends DataExtension + { /** * Modify the field set to be displayed in the CMS detail pop-up diff --git a/docs/en/02_Developer_Guides/09_Security/04_Secure_Coding.md b/docs/en/02_Developer_Guides/09_Security/04_Secure_Coding.md index 163581b60..565f3167f 100644 --- a/docs/en/02_Developer_Guides/09_Security/04_Secure_Coding.md +++ b/docs/en/02_Developer_Guides/09_Security/04_Secure_Coding.md @@ -114,7 +114,8 @@ Example: ```php - class MyForm extends Form { + class MyForm extends Form + { public function save($RAW_data, $form) { // Pass true as the second parameter of raw2sql to quote the value safely $SQL_data = Convert::raw2sql($RAW_data, true); // works recursively on an array @@ -132,7 +133,8 @@ Example: ```php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = ['myurlaction']; public function myurlaction($RAW_urlParams) { // Pass true as the second parameter of raw2sql to quote the value safely @@ -150,7 +152,8 @@ passing data through, escaping should happen at the end of the chain. ```php - class MyController extends Controller { + class MyController extends Controller + { /** * @param array $RAW_data All names in an indexed array (not SQL-safe) */ @@ -231,7 +234,8 @@ PHP: ```php - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $db = [ 'MyEscapedValue' => 'Text', // Example value: not bold 'MyUnescapedValue' => 'HTMLText' // Example value: bold @@ -280,7 +284,8 @@ PHP: ```php - class MyObject extends DataObject { + class MyObject extends DataObject + { public $Title = 'not bold'; // will be escaped due to Text casting $casting = [ @@ -322,7 +327,8 @@ PHP: ```php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = ['search']; public function search($request) { $htmlTitle = '

Your results for:' . Convert::raw2xml($request->getVar('Query')) . '

'; @@ -355,7 +361,8 @@ PHP: ```php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = ['search']; public function search($request) { $rssRelativeLink = "/rss?Query=" . urlencode($_REQUEST['query']) . "&sortOrder=asc"; @@ -548,7 +555,8 @@ controller's `init()` method: ```php - class MyController extends Controller { + class MyController extends Controller + { public function init() { parent::init(); $this->getResponse()->addHeader('X-Frame-Options', 'SAMEORIGIN'); @@ -687,7 +695,8 @@ and `Date: ` will ensure that sensitive content is not stored loca unauthorised local persons. SilverStripe adds the current date for every request, and we can add the other cache headers to the request for our secure controllers: ```php - class MySecureController extends Controller { + class MySecureController extends Controller + { public function init() { parent::init(); diff --git a/docs/en/02_Developer_Guides/11_Integration/00_CSV_Import.md b/docs/en/02_Developer_Guides/11_Integration/00_CSV_Import.md index 4b384f7fe..a7d2c5bc8 100644 --- a/docs/en/02_Developer_Guides/11_Integration/00_CSV_Import.md +++ b/docs/en/02_Developer_Guides/11_Integration/00_CSV_Import.md @@ -49,7 +49,8 @@ The simplest way to use [CsvBulkLoader](api:SilverStripe\Dev\CsvBulkLoader) is t ```php - class PlayerAdmin extends ModelAdmin { + class PlayerAdmin extends ModelAdmin + { private static $managed_models = [ 'Player' ]; @@ -74,7 +75,8 @@ You'll need to add a route to your controller to make it accessible via URL ```php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = ['Form']; @@ -134,7 +136,8 @@ Datamodel for Player ```php - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'PlayerNumber' => 'Int', 'FirstName' => 'Text', @@ -153,7 +156,8 @@ Datamodel for FootballTeam: ```php - class FootballTeam extends DataObject { + class FootballTeam extends DataObject + { private static $db = [ 'Title' => 'Text', ]; @@ -172,7 +176,8 @@ Sample implementation of a custom loader. Assumes a CSV-file in a certain format * Avoids duplicate imports by a custom `$duplicateChecks` definition * Creates `Team` relations automatically based on the `Gruppe` column in the CSV data ```php - class PlayerCsvBulkLoader extends CsvBulkLoader { + class PlayerCsvBulkLoader extends CsvBulkLoader + { public $columnMap = [ 'Number' => 'PlayerNumber', 'Name' => '->importFirstAndLastName', @@ -206,7 +211,8 @@ Building off of the ModelAdmin example up top, use a custom loader instead of th ```php - class PlayerAdmin extends ModelAdmin { + class PlayerAdmin extends ModelAdmin + { private static $managed_models = [ 'Player' ]; diff --git a/docs/en/02_Developer_Guides/11_Integration/01_RestfulService.md b/docs/en/02_Developer_Guides/11_Integration/01_RestfulService.md index 3417328fb..63d581b39 100644 --- a/docs/en/02_Developer_Guides/11_Integration/01_RestfulService.md +++ b/docs/en/02_Developer_Guides/11_Integration/01_RestfulService.md @@ -160,8 +160,8 @@ If the web service returned an error (for example, API key not available or inad ```php - - class MyRestfulService extends RestfulService { + class MyRestfulService extends RestfulService + { public function errorCatch($response) { $err_msg = $response; @@ -179,8 +179,8 @@ If you want to bypass error handling, define `checkErrors` in the constructor fo ```php - - class MyRestfulService extends RestfulService { + class MyRestfulService extends RestfulService + { public function __construct($expiry = NULL) { parent::__construct('http://www.flickr.com/services/rest/', $expiry); diff --git a/docs/en/02_Developer_Guides/11_Integration/02_RSSFeed.md b/docs/en/02_Developer_Guides/11_Integration/02_RSSFeed.md index c16cfce86..b34ba1ee3 100644 --- a/docs/en/02_Developer_Guides/11_Integration/02_RSSFeed.md +++ b/docs/en/02_Developer_Guides/11_Integration/02_RSSFeed.md @@ -58,8 +58,8 @@ You can use [RSSFeed](api:SilverStripe\Control\RSS\RSSFeed) to easily create a f ```php .. - - class PageController extends ContentController { + class PageController extends ContentController + { private static $allowed_actions = [ 'rss' @@ -103,8 +103,8 @@ method is defined and returns a string to the full website URL. ```php - - class Player extends DataObject { + class Player extends DataObject + { public function AbsoluteLink() { // assumes players can be accessed at yoursite.com/players/2 @@ -122,8 +122,8 @@ Then in our controller, we add a new action which returns a the XML list of `Pla ```php - - class PageController extends ContentController { + class PageController extends ContentController + { private static $allowed_actions = [ 'players' diff --git a/docs/en/02_Developer_Guides/11_Integration/How_Tos/Import_CSV_through_a_Controller.md b/docs/en/02_Developer_Guides/11_Integration/How_Tos/Import_CSV_through_a_Controller.md index 840f03a92..561c1cc20 100644 --- a/docs/en/02_Developer_Guides/11_Integration/How_Tos/Import_CSV_through_a_Controller.md +++ b/docs/en/02_Developer_Guides/11_Integration/How_Tos/Import_CSV_through_a_Controller.md @@ -8,8 +8,8 @@ form (which is used for `MyDataObject` instances). You can access it through ```php - - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = [ 'Form' diff --git a/docs/en/02_Developer_Guides/11_Integration/How_Tos/custom_csvbulkloader.md b/docs/en/02_Developer_Guides/11_Integration/How_Tos/custom_csvbulkloader.md index cfe69a6df..d6b45c92d 100644 --- a/docs/en/02_Developer_Guides/11_Integration/How_Tos/custom_csvbulkloader.md +++ b/docs/en/02_Developer_Guides/11_Integration/How_Tos/custom_csvbulkloader.md @@ -17,8 +17,8 @@ information about the individual player and a relation set up for managing the ` ```php - - class Player extends DataObject { + class Player extends DataObject + { private static $db = [ 'PlayerNumber' => 'Int', @@ -38,8 +38,8 @@ information about the individual player and a relation set up for managing the ` ```php - - class FootballTeam extends DataObject { + class FootballTeam extends DataObject + { private static $db = [ 'Title' => 'Text' @@ -68,8 +68,8 @@ Our final import looks like this. ```php - - class PlayerCsvBulkLoader extends CsvBulkLoader { + class PlayerCsvBulkLoader extends CsvBulkLoader + { public $columnMap = [ 'Number' => 'PlayerNumber', diff --git a/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md b/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md index fb08bf4e0..1ddc6ee76 100644 --- a/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md +++ b/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md @@ -20,8 +20,8 @@ Defining search-able fields on your DataObject. ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $searchable_fields = [ 'Name', @@ -39,8 +39,8 @@ and `MyDate`. The attribute `HiddenProperty` should not be searchable, and `MyDa ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $db = [ 'PublicProperty' => 'Text' @@ -84,8 +84,8 @@ the `$fields` constructor parameter. ```php // .. - - class PageController extends ContentController { + class PageController extends ContentController + { public function SearchForm() { $context = singleton('MyDataObject')->getCustomSearchContext(); diff --git a/docs/en/02_Developer_Guides/12_Search/02_FulltextSearch.md b/docs/en/02_Developer_Guides/12_Search/02_FulltextSearch.md index 5e25ebf31..0a1c4aa03 100644 --- a/docs/en/02_Developer_Guides/12_Search/02_FulltextSearch.md +++ b/docs/en/02_Developer_Guides/12_Search/02_FulltextSearch.md @@ -23,8 +23,8 @@ You can do so by adding this static variable to your class definition: ```php - - class MyDataObject extends DataObject { + class MyDataObject extends DataObject + { private static $create_table_options = [ 'MySQLDatabase' => 'ENGINE=MyISAM' @@ -50,7 +50,8 @@ Example DataObject: ```php - class SearchableDataObject extends DataObject { + class SearchableDataObject extends DataObject + { private static $db = [ "Title" => "Varchar(255)", diff --git a/docs/en/02_Developer_Guides/14_Files/01_File_Management.md b/docs/en/02_Developer_Guides/14_Files/01_File_Management.md index 9bb4f711c..03ee4798a 100644 --- a/docs/en/02_Developer_Guides/14_Files/01_File_Management.md +++ b/docs/en/02_Developer_Guides/14_Files/01_File_Management.md @@ -53,7 +53,8 @@ within the assets folder). For example, to load a temporary file into a DataObject you could use the below: ```php 'DBFile' ]; diff --git a/docs/en/02_Developer_Guides/14_Files/03_File_Security.md b/docs/en/02_Developer_Guides/14_Files/03_File_Security.md index e1ab21e6e..3f408aeef 100644 --- a/docs/en/02_Developer_Guides/14_Files/03_File_Security.md +++ b/docs/en/02_Developer_Guides/14_Files/03_File_Security.md @@ -65,7 +65,8 @@ authorised users, the following should be considered: ```php - class PageController extends ContentController { + class PageController extends ContentController + { public function init() { parent::init(); // Whitelist any protected files on this page for the current user @@ -96,7 +97,8 @@ authorised users, the following should be considered: ```php - class PageController extends ContentController { + class PageController extends ContentController + { public function init() { parent::init(); // Whitelist any protected files on this page for the current user @@ -309,7 +311,8 @@ the `Versioned` extension. ```php - class MyVersiondObject extends DataObject { + class MyVersiondObject extends DataObject + { /** Ensure assets are archived along with the DataObject */ private static $keep_archived_assets = true; /** Versioned */ diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md index 3f45f7b57..84655ac6e 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md @@ -21,8 +21,8 @@ a category. ```php - - class Product extends DataObject { + class Product extends DataObject + { private static $db = [ 'Name' => 'Varchar', @@ -41,8 +41,8 @@ a category. ```php - - class Category extends DataObject { + class Category extends DataObject + { private static $db = [ 'Title' => 'Text' @@ -64,8 +64,8 @@ We'll name it `MyAdmin`, but the class name can be anything you want. ```php - - class MyAdmin extends ModelAdmin { + class MyAdmin extends ModelAdmin + { private static $managed_models = [ 'Product', @@ -104,8 +104,8 @@ permissions by default. For most cases, less restrictive checks make sense, e.g. ```php - - class Category extends DataObject { + class Category extends DataObject + { // ... public function canView($member = null) { return Permission::check('CMS_ACCESS_MyAdmin', 'any', $member); @@ -138,8 +138,8 @@ class (see [SearchContext](../search/searchcontext) docs for details). ```php - - class Product extends DataObject { + class Product extends DataObject + { private static $searchable_fields = [ 'Name', @@ -163,8 +163,8 @@ model class, where you can add or remove columns. To change the title, use [Data ```php - - class Product extends DataObject { + class Product extends DataObject + { private static $field_labels = [ 'Price' => 'Cost' // renames the column to "Cost" @@ -188,8 +188,8 @@ For example, we might want to exclude all products without prices in our sample ```php - - class MyAdmin extends ModelAdmin { + class MyAdmin extends ModelAdmin + { public function getList() { $list = parent::getList(); @@ -211,8 +211,8 @@ checkbox which limits search results to expensive products (over $100). ```php - - class MyAdmin extends ModelAdmin { + class MyAdmin extends ModelAdmin + { public function getSearchContext() { $context = parent::getSearchContext(); @@ -245,8 +245,8 @@ example, to add a new component. ```php - - class MyAdmin extends ModelAdmin { + class MyAdmin extends ModelAdmin + { private static $managed_models = [ 'Product', @@ -279,8 +279,8 @@ to only one specific `GridField`: ```php - - class MyAdmin extends ModelAdmin { + class MyAdmin extends ModelAdmin + { private static $managed_models = [ 'Product', @@ -321,8 +321,8 @@ To customize the exported columns, create a new method called `getExportFields` ```php - - class MyAdmin extends ModelAdmin { + class MyAdmin extends ModelAdmin + { // ... public function getExportFields() { diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/02_CMS_Architecture.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/02_CMS_Architecture.md index b578487b1..676687d89 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/02_CMS_Architecture.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/02_CMS_Architecture.md @@ -162,7 +162,8 @@ Basic example form in a CMS controller subclass: ```php - class MyAdmin extends LeftAndMain { + class MyAdmin extends LeftAndMain + { function getEditForm() { return CMSForm::create( $this, @@ -362,7 +363,8 @@ in a single Ajax request. ```php // mysite/code/MyAdmin.php - class MyAdmin extends LeftAndMain { + class MyAdmin extends LeftAndMain + { private static $url_segment = 'myadmin'; public function getResponseNegotiator() { $negotiator = parent::getResponseNegotiator(); @@ -486,8 +488,10 @@ without affecting the response body. ```php - class MyController extends LeftAndMain { - class myaction() { + class MyController extends LeftAndMain + { + class myaction() + { // ... $this->getResponse()->addHeader('X-Controller', 'MyOtherController'); return $html; diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md index 4bc232fe7..df8fd567c 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/06_Javascript_Development.md @@ -421,7 +421,8 @@ PHP: ```php - class MyController { + class MyController + { public function autocomplete($request) { $results = Page::get()->filter("Title", $request->getVar('title')); if(!$results) return new HTTPResponse("Not found", 404); diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/07_ReactJS_Redux_and_GraphQL.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/07_ReactJS_Redux_and_GraphQL.md index b322e770b..29a1af9be 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/07_ReactJS_Redux_and_GraphQL.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/07_ReactJS_Redux_and_GraphQL.md @@ -450,7 +450,9 @@ __my-module/js/components/Gallery.js__ import React from 'react'; import { inject } from 'lib/Injector'; -class Gallery extends React.Component { +class Gallery extends React.Component + +{ render() { const { SearchComponent, ItemComponent } = this.props; return ( @@ -482,7 +484,8 @@ declare them in `inject()`. In cases like this, use `withInjector()`. This highe component puts the `Injector` instance in `context`. ```js -class MyGallery extends React.Component { +class MyGallery extends React.Component +{ render () {
{this.props.items.map(item => { diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Menu.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Menu.md index 948805c77..47d4e8444 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Menu.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Menu.md @@ -22,7 +22,8 @@ black-and-transparent PNG graphics. In this case we'll place the icon in ```php - class ProductAdmin extends ModelAdmin { + class ProductAdmin extends ModelAdmin + { // ... private static $menu_icon = 'mysite/images/product-icon.png'; } @@ -36,7 +37,8 @@ controller, removing the "Admin" bit at the end. ```php - class ProductAdmin extends ModelAdmin { + class ProductAdmin extends ModelAdmin + { // ... private static $menu_title = 'My Custom Admin'; } @@ -60,8 +62,8 @@ button configuration. ```php - - class CustomLeftAndMain extends LeftAndMainExtension { + class CustomLeftAndMain extends LeftAndMainExtension + { public function init() { // unique identifier for this item. Will have an ID of Menu-$ID diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Pages_List.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Pages_List.md index f985cb756..04e8a11fe 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Pages_List.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Pages_List.md @@ -20,12 +20,14 @@ hypothetical `NewsPageHolder` type, which contains `NewsPage` children. ```php // mysite/code/NewsPageHolder.php - class NewsPageHolder extends Page { + class NewsPageHolder extends Page + { private static $allowed_children = ['NewsPage']; } // mysite/code/NewsPage.php - class NewsPage extends Page { + class NewsPage extends Page + { private static $has_one = [ 'Author' => 'Member', ]; @@ -42,7 +44,8 @@ or across page types with common characteristics. ```php // mysite/code/NewsPageHolderCMSMainExtension.php - class NewsPageHolderCMSMainExtension extends Extension { + class NewsPageHolderCMSMainExtension extends Extension + { function updateListView($listView) { $parentId = $listView->getController()->getRequest()->requestVar('ParentID'); $parent = ($parentId) ? Page::get()->byId($parentId) : new Page(); diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Tree.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Tree.md index d33f0a1a0..2ced54bce 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Tree.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_CMS_Tree.md @@ -66,7 +66,8 @@ __Example: using a subclass__ ```php - class Page extends SiteTree { + class Page extends SiteTree + { public function getScheduledToPublish(){ // return either true or false } diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_React_Forms.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_React_Forms.md index 9dae81749..e05c468ad 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_React_Forms.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_React_Forms.md @@ -161,7 +161,8 @@ _my-module/js/src/ConfirmingFormAction.js_ import React from 'react'; export default (FormAction) => { - class ConfirmingFormAction extends React.Component { + class ConfirmingFormAction extends React.Component + { constructor(props) { super(props); this.state = { confirming: false }; diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_Site_Reports.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_Site_Reports.md index d1a251fe8..d35a36c6a 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_Site_Reports.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Customise_Site_Reports.md @@ -34,7 +34,8 @@ The following example will create a report to list every page on the current sit ###CustomSideReport.php ```php - class CustomSideReport_NameOfReport extends SS_Report { + class CustomSideReport_NameOfReport extends SS_Report + { // the name of the report public function title() { diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extend_CMS_Interface.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extend_CMS_Interface.md index 4fec5ceec..693d76864 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extend_CMS_Interface.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extend_CMS_Interface.md @@ -80,8 +80,8 @@ and insert the following code. ```php - - class BookmarkedPageExtension extends DataExtension { + class BookmarkedPageExtension extends DataExtension + { private static $db = [ 'IsBookmarked' => 'Boolean' @@ -120,8 +120,8 @@ Add the following code to a new file `mysite/code/BookmarkedLeftAndMainExtension ```php - - class BookmarkedPagesLeftAndMainExtension extends LeftAndMainExtension { + class BookmarkedPagesLeftAndMainExtension extends LeftAndMainExtension + { public function BookmarkedPages() { return Page::get()->filter("IsBookmarked", 1); @@ -236,7 +236,8 @@ applicable controller actions to it: ```php - class CustomActionsExtension extends LeftAndMainExtension { + class CustomActionsExtension extends LeftAndMainExtension + { private static $allowed_actions = [ 'sampleAction' diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extending_An_Existing_ModelAdmin.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extending_An_Existing_ModelAdmin.md index 45b7ec0a4..32db46fce 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extending_An_Existing_ModelAdmin.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extending_An_Existing_ModelAdmin.md @@ -5,7 +5,8 @@ also another tool at your disposal: The [Extension](api:SilverStripe\Core\Extens ```php - class MyAdminExtension extends Extension { + class MyAdminExtension extends Extension + { // ... public function updateEditForm(&$form) { $form->Fields()->push(/* ... */) diff --git a/docs/en/02_Developer_Guides/16_Execution_Pipeline/01_Flushable.md b/docs/en/02_Developer_Guides/16_Execution_Pipeline/01_Flushable.md index fface88e4..07b9c2d1a 100644 --- a/docs/en/02_Developer_Guides/16_Execution_Pipeline/01_Flushable.md +++ b/docs/en/02_Developer_Guides/16_Execution_Pipeline/01_Flushable.md @@ -20,7 +20,8 @@ This example uses [Cache](api:Cache) in some custom code, and the same cache is ```php - class MyClass extends DataObject implements Flushable { + class MyClass extends DataObject implements Flushable + { public static function flush() { Cache::factory('mycache')->clean(Zend_Cache::CLEANING_MODE_ALL); @@ -46,7 +47,8 @@ useful in an example like `GD` or `Imagick` generating resampled images, but we flush so they are re-created on demand. ```php - class MyClass extends DataObject implements Flushable { + class MyClass extends DataObject implements Flushable + { public static function flush() { foreach(glob(ASSETS_PATH . '/_tempfiles/*.jpg') as $file) { diff --git a/docs/en/02_Developer_Guides/17_CLI/index.md b/docs/en/02_Developer_Guides/17_CLI/index.md index 23a2d12f2..c0fa0e1c1 100644 --- a/docs/en/02_Developer_Guides/17_CLI/index.md +++ b/docs/en/02_Developer_Guides/17_CLI/index.md @@ -93,8 +93,8 @@ This code provides a good template: ```php - - class MyProcess extends Controller { + class MyProcess extends Controller + { private static $allowed_actions = [ 'index' diff --git a/docs/en/04_Changelogs/2.3.2.md b/docs/en/04_Changelogs/2.3.2.md index e5f6df6d9..ee5ce8ed6 100644 --- a/docs/en/04_Changelogs/2.3.2.md +++ b/docs/en/04_Changelogs/2.3.2.md @@ -74,7 +74,8 @@ Because of this, you will need to change the static definitions in your ModelAdm change this: :::php - class MyCatalogAdmin extends ModelAdmin { + class MyCatalogAdmin extends ModelAdmin + { protected static $managed_models = array( 'Product', @@ -88,7 +89,8 @@ change this: To this: :::php - class MyCatalogAdmin extends ModelAdmin { + class MyCatalogAdmin extends ModelAdmin + { public static $managed_models = array( 'Product', diff --git a/docs/en/04_Changelogs/2.4.0.md b/docs/en/04_Changelogs/2.4.0.md index 76e8b9b50..36dc3fbfb 100644 --- a/docs/en/04_Changelogs/2.4.0.md +++ b/docs/en/04_Changelogs/2.4.0.md @@ -188,7 +188,8 @@ getter. You need to manually call *setOwner($this)* before using the instance. Base setup: :::php - class MyExtension extends Extension { + class MyExtension extends Extension + { function myExtensionMethod() { // ... } } Object::add_extension('MyObject', 'MyExtension'); @@ -197,7 +198,8 @@ Base setup: Wrong: :::php - class MyObject extends DataObject { + class MyObject extends DataObject + { function myExtensionMethod() { $ext = $this->extension_instances['MyExtension']; return $ext->myExtensionMethod(); @@ -208,7 +210,8 @@ Wrong: Right: :::php - class MyObject extends DataObject { + class MyObject extends DataObject + { function myExtensionMethod() { $ext = $this->getExtensionInstance('MyExtension'); $ext->setOwner($this); diff --git a/docs/en/04_Changelogs/2.4.1.md b/docs/en/04_Changelogs/2.4.1.md index 32cc61a5f..f7d8e4bc7 100644 --- a/docs/en/04_Changelogs/2.4.1.md +++ b/docs/en/04_Changelogs/2.4.1.md @@ -127,7 +127,8 @@ To clarify: Leaving existing decorators unchanged might mean that you allow acti // 2.4.0 :::php - class MyDecorator extends DataObjectDecorator { + class MyDecorator extends DataObjectDecorator + { function canEdit($member) { if(Permission::checkMember($member, 'MYPERMISSION')) { return true; @@ -139,7 +140,8 @@ To clarify: Leaving existing decorators unchanged might mean that you allow acti // 2.4.1 :::php - class MyDecorator extends DataObjectDecorator { + class MyDecorator extends DataObjectDecorator + { function canEdit($member) { if(Permission::checkMember($member, 'MYPERMISSION')) { return null; // Means the permission check will be ignored, instead of forced to TRUE diff --git a/docs/en/04_Changelogs/2.4.3.md b/docs/en/04_Changelogs/2.4.3.md index 4373015b6..2db4ec214 100644 --- a/docs/en/04_Changelogs/2.4.3.md +++ b/docs/en/04_Changelogs/2.4.3.md @@ -48,7 +48,8 @@ parameters (//$data, $form// instead of *$request*). :::php // Form field actions - class MyFormField extends FormField { + class MyFormField extends FormField + { // Form fields always have a reference to their form. // Use the form-specific token instance. @@ -61,7 +62,8 @@ parameters (//$data, $form// instead of *$request*). } // Controller actions (GET and POST) without form - class MyController extends Controller { + class MyController extends Controller + { // Manually adds token to link function DeleteLink() { @@ -84,7 +86,8 @@ parameters (//$data, $form// instead of *$request*). } // Controller actions (GET and POST) with form - class MyController extends Controller { + class MyController extends Controller + { // Forms have CSRF protection turned on by default, // will add a HiddenField instance called "SecurityID" @@ -160,7 +163,8 @@ parameters don't break through string concatenation. Full controller example: :::php - class MyController extends Controller { + class MyController extends Controller + { function export($request) { // ... @@ -189,7 +193,8 @@ mandatory "SecurityID" GET parameter appended to the base link. You can manually enable security tokens, either globally or for a specific form. :::php - class MyTest extends SapphireTest { + class MyTest extends SapphireTest + { // option 1: enable for all forms created through this test function setUp() { diff --git a/docs/en/04_Changelogs/3.0.0.md b/docs/en/04_Changelogs/3.0.0.md index e0f58434a..cd193a33a 100644 --- a/docs/en/04_Changelogs/3.0.0.md +++ b/docs/en/04_Changelogs/3.0.0.md @@ -143,7 +143,8 @@ If you need custom logic, e.g. checking for a class before applying the statics you can use `add_to_class()` as a replacement to `extraStatics()`. :::php - class MyExtension extends Extension { + class MyExtension extends Extension + { // before function extraStatics($class, $extensionClass) { diff --git a/docs/en/04_Changelogs/3.0.9.md b/docs/en/04_Changelogs/3.0.9.md index 089cde8f8..4e82a163e 100644 --- a/docs/en/04_Changelogs/3.0.9.md +++ b/docs/en/04_Changelogs/3.0.9.md @@ -21,7 +21,8 @@ and doesn't check if the user is authenticated to view it. As with any other con please use `DataObject->canView()` to determine permissions. :::php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = array('showpage'); public function showpage($request) { $page = Page::get()->byID($request->param('ID')); diff --git a/docs/en/04_Changelogs/3.1.0.md b/docs/en/04_Changelogs/3.1.0.md index b51fbe44a..95b046cd5 100644 --- a/docs/en/04_Changelogs/3.1.0.md +++ b/docs/en/04_Changelogs/3.1.0.md @@ -75,10 +75,12 @@ Before: :::php 'Text'); } - class Page_Controller extends ContentController { + class Page_Controller extends ContentController + { static $allowed_actions = array('myaction'); } @@ -86,10 +88,12 @@ After: :::php 'Text'); } - class Page_Controller extends ContentController { + class Page_Controller extends ContentController + { private static $allowed_actions = array('myaction'); } @@ -116,7 +120,8 @@ as such. This can either be done by returning an HTMLText object, like: or by defining the casting of the accessor method, like: :::php - class Page extends SiteTree { + class Page extends SiteTree + { private static $casting = array( 'MyDiv' => 'HTMLText' ) @@ -242,7 +247,8 @@ understand, the routing will require definition of `$allowed_actions` on your own `Controller` subclasses if they contain any actions accessible through URLs. :::php - class MyController extends Controller { + class MyController extends Controller + { // This action is now denied because no $allowed_actions are specified public function myaction($request) {} } @@ -263,7 +269,8 @@ particularly around inherited rules. We've decided to remove the feature, you'll need to specificy each accessible action individually. :::php - class MyController extends Controller { + class MyController extends Controller + { public static $allowed_actions = array('*' => 'ADMIN'); // Always denied because not explicitly listed in $allowed_actions public function myaction($request) {} @@ -281,11 +288,13 @@ to methods defined on the class they're also defined on. Overriding inherited access definitions is no longer possible. :::php - class MyController extends Controller { + class MyController extends Controller + { public static $allowed_actions = array('myaction' => 'ADMIN'); public function myaction($request) {} } - class MySubController extends MyController { + class MySubController extends MyController + { // No longer works public static $allowed_actions = array('myaction' => 'CMS_ACCESS_CMSMAIN'); } @@ -298,7 +307,8 @@ can only grant or deny access or methods they define themselves. New approach with the [Config API](/developer_guides/configuration/configuration) :::php - class MySubController extends MyController { + class MySubController extends MyController + { public function init() { parent::init(); @@ -321,7 +331,8 @@ If you have previously added, removed or altered built-in CMS actions in any way you'll need to adjust your code. :::php - class MyPage extends Page { + class MyPage extends Page + { function getCMSActions() { $actions = parent::getCMSActions(); @@ -363,7 +374,8 @@ Since `GridField` is used in `ModelAdmin`, this change will affect both classes. Example: Require "CMS: Pages section" access :::php - class MyModel extends DataObject { + class MyModel extends DataObject + { public function canView($member = null) { return Permission::check('CMS_ACCESS_CMSMain', 'any', $member); } diff --git a/docs/en/04_Changelogs/3.1.11.md b/docs/en/04_Changelogs/3.1.11.md index 1786b4a6f..e10b439c1 100644 --- a/docs/en/04_Changelogs/3.1.11.md +++ b/docs/en/04_Changelogs/3.1.11.md @@ -33,7 +33,8 @@ E.g. :::php count()) return false; diff --git a/docs/en/04_Changelogs/3.1.16.md b/docs/en/04_Changelogs/3.1.16.md index 05981d464..ebaa2215c 100644 --- a/docs/en/04_Changelogs/3.1.16.md +++ b/docs/en/04_Changelogs/3.1.16.md @@ -13,7 +13,8 @@ For example: :::php - class MyCustomValidator extends Validator { + class MyCustomValidator extends Validator + { public function php($data) { $this->validationError( 'EmailAddress', diff --git a/docs/en/04_Changelogs/3.1.19.md b/docs/en/04_Changelogs/3.1.19.md index a304ced10..5854644ed 100644 --- a/docs/en/04_Changelogs/3.1.19.md +++ b/docs/en/04_Changelogs/3.1.19.md @@ -8,7 +8,8 @@ login forms or other changes. To re-enable this, you'll need to use the `Injecto Define a login form: ```php -class CustomLoginForm extends MemberLoginForm { +class CustomLoginForm extends MemberLoginForm +{ public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) { diff --git a/docs/en/04_Changelogs/3.1.2.md b/docs/en/04_Changelogs/3.1.2.md index 68a1d7cc6..c5b1395e7 100644 --- a/docs/en/04_Changelogs/3.1.2.md +++ b/docs/en/04_Changelogs/3.1.2.md @@ -31,7 +31,8 @@ and doesn't check if the user is authenticated to view it. As with any other con please use `DataObject->canView()` to determine permissions. :::php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = array('showpage'); public function showpage($request) { $page = Page::get()->byID($request->param('ID')); diff --git a/docs/en/04_Changelogs/3.1.9.md b/docs/en/04_Changelogs/3.1.9.md index 7f3abab6e..d7ada580a 100644 --- a/docs/en/04_Changelogs/3.1.9.md +++ b/docs/en/04_Changelogs/3.1.9.md @@ -15,7 +15,8 @@ E.g. :::php validationError( 'EmailAddress', diff --git a/docs/en/04_Changelogs/3.2.4.md b/docs/en/04_Changelogs/3.2.4.md index a8668d9ba..54d200e13 100644 --- a/docs/en/04_Changelogs/3.2.4.md +++ b/docs/en/04_Changelogs/3.2.4.md @@ -8,7 +8,8 @@ login forms or other changes. To re-enable this, you'll need to use the `Injecto Define a login form: ```php -class CustomLoginForm extends MemberLoginForm { +class CustomLoginForm extends MemberLoginForm +{ public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) { diff --git a/docs/en/04_Changelogs/3.3.2.md b/docs/en/04_Changelogs/3.3.2.md index 119d5ba6e..a30063d2d 100644 --- a/docs/en/04_Changelogs/3.3.2.md +++ b/docs/en/04_Changelogs/3.3.2.md @@ -8,7 +8,8 @@ login forms or other changes. To re-enable this, you'll need to use the `Injecto Define a login form: ```php -class CustomLoginForm extends MemberLoginForm { +class CustomLoginForm extends MemberLoginForm +{ public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) { diff --git a/docs/en/04_Changelogs/4.0.0.md b/docs/en/04_Changelogs/4.0.0.md index 7e1846ff5..207f45351 100644 --- a/docs/en/04_Changelogs/4.0.0.md +++ b/docs/en/04_Changelogs/4.0.0.md @@ -994,7 +994,9 @@ Before this change, to use the handle_shortcode method, you would do something l ``` "Image" ); @@ -451,7 +452,8 @@ Before: :::php // in MyImageExtension.php - class MyImageExtension extends DataExtension { + class MyImageExtension extends DataExtension + { public function GalleryThumbnail($height) { return $this->getFormattedImage('GalleryThumbnail', $height); } @@ -471,7 +473,8 @@ After: :::php // in MyImageExtension.php - class MyImageExtension extends Extension { + class MyImageExtension extends Extension + { public function GalleryThumbnail($height) { // Generates the manipulation key $variant = $this->owner->variantName(__FUNCTION__, $height); @@ -509,7 +512,8 @@ The below describes the minimum amount of effort required to implement a composi :::php 'Varchar(200)', @@ -607,7 +611,8 @@ E.g. :::php - class MyErrorPageExtension extends SiteTreeExtension { + class MyErrorPageExtension extends SiteTreeExtension + { public function updateErrorFilename(&$name, &$statuscode) { if($this->owner->exists()) { $locale = $this->Locale; @@ -721,7 +726,8 @@ For instance: /** * This model has staging and versioning. Stages will be "Stage" and "Live" */ - class MyStagedModel extends DataObject { + class MyStagedModel extends DataObject + { private staic $extensions = array( "Versioned('StagedVersioned')" ); @@ -730,7 +736,8 @@ For instance: /** * This model has versioning only, and will not has a draft or live stage, nor be affected by the current stage. */ - class MyVersionedModel extends DataObject { + class MyVersionedModel extends DataObject + { private static $extensions = array( "Versioned('Versioned')" ); @@ -783,8 +790,8 @@ This means that for the most part, code that worked in 3.0 won't need to be chan An exception to this is any classes which once had the `SS_` prefix, which will now be instead prefixed with `DB`, and have an un-aliased prefix. For example `SS_Datetime` is now `DBDateTime`, and has the alias `DateTime` which may be used in config. For example: - - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $db = array( 'Number' => 'Int', 'Time' => 'SS_Datetime' @@ -802,8 +809,8 @@ For example: Will become: use SilverStripe\Model\FieldType\DBVarchar; - - class MyObject extends DataObject { + class MyObject extends DataObject + { private static $db = array( 'Number' => 'Int', 'Time' => 'Datetime' diff --git a/docs/en/04_Changelogs/beta/3.2.0-beta1.md b/docs/en/04_Changelogs/beta/3.2.0-beta1.md index fe309c038..c992d16d5 100644 --- a/docs/en/04_Changelogs/beta/3.2.0-beta1.md +++ b/docs/en/04_Changelogs/beta/3.2.0-beta1.md @@ -276,7 +276,8 @@ simply use the provided page URLs. :::php - class MyController extends Controller { + class MyController extends Controller + { static $allowed_actions = array('myaction'); public function myaction($request) { // ... diff --git a/docs/en/04_Changelogs/rc/3.1.2-rc1.md b/docs/en/04_Changelogs/rc/3.1.2-rc1.md index d5461a66d..cfa614117 100644 --- a/docs/en/04_Changelogs/rc/3.1.2-rc1.md +++ b/docs/en/04_Changelogs/rc/3.1.2-rc1.md @@ -31,7 +31,8 @@ and doesn't check if the user is authenticated to view it. As with any other con please use `DataObject->canView()` to determine permissions. :::php - class MyController extends Controller { + class MyController extends Controller + { private static $allowed_actions = array('showpage'); public function showpage($request) { $page = Page::get()->byID($request->param('ID'));