@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | return ChangeSet::get() |
119 | 119 | ->filter('State', ChangeSet::STATE_OPEN) |
120 | - ->filterByCallback(function ($item) { |
|
120 | + ->filterByCallback(function($item) { |
|
121 | 121 | /** @var ChangeSet $item */ |
122 | 122 | return $item->canView(); |
123 | 123 | }); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function getObject($id, $class) |
157 | 157 | { |
158 | - $id = (int)$id; |
|
158 | + $id = (int) $id; |
|
159 | 159 | $class = ClassInfo::class_name($class); |
160 | 160 | |
161 | 161 | if (!$class |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | if (is_array($data) && !empty($data['Campaign'])) { |
454 | 454 | $campaignID = $data['Campaign']; |
455 | 455 | } elseif (is_numeric($data)) { |
456 | - $campaignID = (int)$data; |
|
456 | + $campaignID = (int) $data; |
|
457 | 457 | } |
458 | 458 | if (empty($campaignID)) { |
459 | 459 | throw $this->validationResult(_t(__CLASS__ . '.NONE_SELECTED', 'No campaign selected')); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | public function __construct() |
16 | 16 | { |
17 | - parent::__construct('addtocampaign', _t(__CLASS__.'.ADDTOCAMPAIGN', 'Add to Campaign')); |
|
17 | + parent::__construct('addtocampaign', _t(__CLASS__ . '.ADDTOCAMPAIGN', 'Add to Campaign')); |
|
18 | 18 | $this->setUseButtonTag(false); |
19 | 19 | $this->addExtraClass('add-to-campaign-action'); |
20 | 20 | $this->addExtraClass('btn'); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | "url" => $oneSetAction, |
60 | 60 | "method" => "DELETE" |
61 | 61 | ]; |
62 | - $data['data']['editFormSchemaEndpoint'] = $schemaEndpoint; |
|
62 | + $data['data']['editFormSchemaEndpoint'] = $schemaEndpoint; |
|
63 | 63 | |
64 | 64 | // Set summary columns |
65 | 65 | $columns = []; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $form->addExtraClass('form--padded'); |
169 | 169 | |
170 | 170 | // Set callback response |
171 | - $form->setValidationResponseCallback(function () use ($form) { |
|
171 | + $form->setValidationResponseCallback(function() use ($form) { |
|
172 | 172 | $schemaId = $this->Link('schema/EditForm'); |
173 | 173 | return $this->getSchemaResponse($form, $schemaId); |
174 | 174 | }); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'baseClass' => DataObject::getSchema()->baseDataClass($class), |
216 | 216 | 'singular' => $item->i18n_singular_name(), |
217 | 217 | 'plural' => $item->i18n_plural_name(), |
218 | - 'noItemsText' => _t(__CLASS__.'.NOITEMSTEXT', 'Add items from the {section} section', [ |
|
218 | + 'noItemsText' => _t(__CLASS__ . '.NOITEMSTEXT', 'Add items from the {section} section', [ |
|
219 | 219 | 'section' => $item->i18n_plural_name(), |
220 | 220 | ]), |
221 | 221 | 'items' => [] |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | 'Created' => $changeSet->Created, |
284 | 284 | 'LastEdited' => $changeSet->LastEdited, |
285 | 285 | 'State' => $changeSet->State, |
286 | - 'StateLabel' => [ 'html' => $stateLabel ], |
|
286 | + 'StateLabel' => ['html' => $stateLabel], |
|
287 | 287 | 'IsInferred' => $changeSet->IsInferred, |
288 | 288 | 'canEdit' => $changeSet->canEdit(), |
289 | 289 | 'canPublish' => false, |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | { |
331 | 331 | $baseClass = DataObject::getSchema()->baseDataClass($changeSetItem->ObjectClass); |
332 | 332 | $baseSingleton = DataObject::singleton($baseClass); |
333 | - $thumbnailWidth = (int)$this->config()->get('thumbnail_width'); |
|
334 | - $thumbnailHeight = (int)$this->config()->get('thumbnail_height'); |
|
333 | + $thumbnailWidth = (int) $this->config()->get('thumbnail_width'); |
|
334 | + $thumbnailHeight = (int) $this->config()->get('thumbnail_height'); |
|
335 | 335 | $hal = [ |
336 | 336 | '_links' => [ |
337 | 337 | 'self' => [ |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $changesets = $changesets->filter('IsInferred', 0); |
412 | 412 | } |
413 | 413 | return $changesets |
414 | - ->filterByCallback(function ($item) { |
|
414 | + ->filterByCallback(function($item) { |
|
415 | 415 | /** @var ChangeSet $item */ |
416 | 416 | return ($item->canView()); |
417 | 417 | }); |
@@ -616,19 +616,19 @@ discard block |
||
616 | 616 | 'campaignEditForm', |
617 | 617 | $fields, |
618 | 618 | FieldList::create( |
619 | - FormAction::create('save', _t(__CLASS__.'SAVE', 'Save')) |
|
619 | + FormAction::create('save', _t(__CLASS__ . 'SAVE', 'Save')) |
|
620 | 620 | ->setIcon('save') |
621 | 621 | ->setSchemaState([ |
622 | 622 | 'data' => [ |
623 | - 'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'), |
|
623 | + 'pristineTitle' => _t(__CLASS__ . 'SAVED', 'Saved'), |
|
624 | 624 | 'pristineIcon' => 'tick', |
625 | - 'dirtyTitle' => _t(__CLASS__.'SAVE', 'Save'), |
|
625 | + 'dirtyTitle' => _t(__CLASS__ . 'SAVE', 'Save'), |
|
626 | 626 | 'dirtyIcon' => 'save', |
627 | 627 | 'pristineClass' => 'btn-outline-primary', |
628 | 628 | 'dirtyClass' => '', |
629 | 629 | ], |
630 | 630 | ]), |
631 | - FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) |
|
631 | + FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel')) |
|
632 | 632 | ->setUseButtonTag(true) |
633 | 633 | ), |
634 | 634 | new RequiredFields('Name') |
@@ -639,12 +639,12 @@ discard block |
||
639 | 639 | |
640 | 640 | // Set form action handler with ID included |
641 | 641 | $form->setRequestHandler( |
642 | - LeftAndMainFormRequestHandler::create($form, [ $id ]) |
|
642 | + LeftAndMainFormRequestHandler::create($form, [$id]) |
|
643 | 643 | ); |
644 | 644 | |
645 | 645 | // Configure form to respond to validation errors with form schema |
646 | 646 | // if requested via react. |
647 | - $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $id, $record) { |
|
647 | + $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $id, $record) { |
|
648 | 648 | $schemaId = Controller::join_links( |
649 | 649 | $this->Link('schema'), |
650 | 650 | 'campaignEditForm', |
@@ -691,9 +691,9 @@ discard block |
||
691 | 691 | 'campaignCreateForm', |
692 | 692 | $fields, |
693 | 693 | FieldList::create( |
694 | - FormAction::create('save', _t(__CLASS__.'.CREATE', 'Create')) |
|
694 | + FormAction::create('save', _t(__CLASS__ . '.CREATE', 'Create')) |
|
695 | 695 | ->setIcon('plus'), |
696 | - FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) |
|
696 | + FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel')) |
|
697 | 697 | ->setUseButtonTag(true) |
698 | 698 | ), |
699 | 699 | new RequiredFields('Name') |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | |
707 | 707 | // Configure form to respond to validation errors with form schema |
708 | 708 | // if requested via react. |
709 | - $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $record) { |
|
709 | + $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $record) { |
|
710 | 710 | $schemaId = $this->Link('schema/campaignCreateForm'); |
711 | 711 | return $this->getSchemaResponse($schemaId, $form, $errors); |
712 | 712 | }); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | return Security::permissionFailure($this); |
736 | 736 | } |
737 | 737 | if (!$record || !$record->ID) { |
738 | - $this->httpError(404, "Bad record ID #" . (int)$id); |
|
738 | + $this->httpError(404, "Bad record ID #" . (int) $id); |
|
739 | 739 | } |
740 | 740 | } else { |
741 | 741 | if (!ChangeSet::singleton()->canCreate()) { |
@@ -754,13 +754,13 @@ discard block |
||
754 | 754 | $form->saveInto($record, true); |
755 | 755 | $record->write(); |
756 | 756 | $this->extend('onAfterSave', $record); |
757 | - $message = _t(__CLASS__.'.SAVEDUP', 'Saved.'); |
|
757 | + $message = _t(__CLASS__ . '.SAVEDUP', 'Saved.'); |
|
758 | 758 | $form->setMessage($message, ValidationResult::TYPE_GOOD); |
759 | 759 | } else { |
760 | - $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', [ 'Name' => $data['Name']]); |
|
760 | + $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', ['Name' => $data['Name']]); |
|
761 | 761 | $errors = new ValidationResult(); |
762 | 762 | $errors->addFieldMessage('Name', $nameDuplicateMsg); |
763 | - $message = _t(__CLASS__.'.SAVEDERROR', 'Error.'); |
|
763 | + $message = _t(__CLASS__ . '.SAVEDERROR', 'Error.'); |
|
764 | 764 | // Need to set the form message or the field message won't show up at all |
765 | 765 | $form->setMessage($message, ValidationResult::TYPE_ERROR); |
766 | 766 | } |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | ), |
819 | 819 | 'category' => _t('SilverStripe\\Security\\Permission.CMS_ACCESS_CATEGORY', 'CMS Access'), |
820 | 820 | 'help' => _t( |
821 | - __CLASS__.'.ACCESS_HELP', |
|
821 | + __CLASS__ . '.ACCESS_HELP', |
|
822 | 822 | 'Allow viewing of the campaign publishing section.' |
823 | 823 | ) |
824 | 824 | ) |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $results = $this->callProtectedMethod($admin, 'getListItems'); |
90 | 90 | $this->assertDOSEquals( |
91 | 91 | [ |
92 | - [ 'Name' => 'changeset 1' ], |
|
92 | + ['Name' => 'changeset 1'], |
|
93 | 93 | ], |
94 | 94 | $results |
95 | 95 | ); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | $results = $this->callProtectedMethod($admin, 'getListItems'); |
100 | 100 | $this->assertDOSEquals( |
101 | 101 | [ |
102 | - [ 'Name' => 'changeset 1' ], |
|
103 | - [ 'Name' => 'changeset 2' ], |
|
102 | + ['Name' => 'changeset 1'], |
|
103 | + ['Name' => 'changeset 2'], |
|
104 | 104 | ], |
105 | 105 | $results |
106 | 106 | ); |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | $results = $this->callProtectedMethod($admin, 'getListItems'); |
111 | 111 | $this->assertDOSEquals( |
112 | 112 | [ |
113 | - [ 'Name' => 'changeset 1' ], |
|
114 | - [ 'Name' => 'changeset 2' ], |
|
115 | - [ 'Name' => 'changeset 3' ], |
|
116 | - [ 'Name' => 'changeset 4' ], |
|
113 | + ['Name' => 'changeset 1'], |
|
114 | + ['Name' => 'changeset 2'], |
|
115 | + ['Name' => 'changeset 3'], |
|
116 | + ['Name' => 'changeset 4'], |
|
117 | 117 | ], |
118 | 118 | $results |
119 | 119 | ); |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | $results = $this->callProtectedMethod($admin, 'getListItems'); |
124 | 124 | $this->assertDOSEquals( |
125 | 125 | [ |
126 | - [ 'Name' => 'changeset 1' ], |
|
127 | - [ 'Name' => 'changeset 3' ], |
|
126 | + ['Name' => 'changeset 1'], |
|
127 | + ['Name' => 'changeset 3'], |
|
128 | 128 | ], |
129 | 129 | $results |
130 | 130 | ); |