@@ -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 = []; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $form = Form::create($this, 'EditForm', $fields, $actions); |
168 | 168 | |
169 | 169 | // Set callback response |
170 | - $form->setValidationResponseCallback(function () use ($form) { |
|
170 | + $form->setValidationResponseCallback(function() use ($form) { |
|
171 | 171 | $schemaId = $this->Link('schema/EditForm'); |
172 | 172 | return $this->getSchemaResponse($form, $schemaId); |
173 | 173 | }); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'baseClass' => DataObject::getSchema()->baseDataClass($class), |
215 | 215 | 'singular' => $item->i18n_singular_name(), |
216 | 216 | 'plural' => $item->i18n_plural_name(), |
217 | - 'noItemsText' => _t(__CLASS__.'.NOITEMSTEXT', 'Add items from the {section} section', [ |
|
217 | + 'noItemsText' => _t(__CLASS__ . '.NOITEMSTEXT', 'Add items from the {section} section', [ |
|
218 | 218 | 'section' => $item->i18n_plural_name(), |
219 | 219 | ]), |
220 | 220 | 'items' => [] |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | 'Created' => $changeSet->Created, |
283 | 283 | 'LastEdited' => $changeSet->LastEdited, |
284 | 284 | 'State' => $changeSet->State, |
285 | - 'StateLabel' => [ 'html' => $stateLabel ], |
|
285 | + 'StateLabel' => ['html' => $stateLabel], |
|
286 | 286 | 'IsInferred' => $changeSet->IsInferred, |
287 | 287 | 'canEdit' => $changeSet->canEdit(), |
288 | 288 | 'canPublish' => false, |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | { |
330 | 330 | $baseClass = DataObject::getSchema()->baseDataClass($changeSetItem->ObjectClass); |
331 | 331 | $baseSingleton = DataObject::singleton($baseClass); |
332 | - $thumbnailWidth = (int)$this->config()->get('thumbnail_width'); |
|
333 | - $thumbnailHeight = (int)$this->config()->get('thumbnail_height'); |
|
332 | + $thumbnailWidth = (int) $this->config()->get('thumbnail_width'); |
|
333 | + $thumbnailHeight = (int) $this->config()->get('thumbnail_height'); |
|
334 | 334 | $hal = [ |
335 | 335 | '_links' => [ |
336 | 336 | 'self' => [ |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $changesets = $changesets->filter('IsInferred', 0); |
411 | 411 | } |
412 | 412 | return $changesets |
413 | - ->filterByCallback(function ($item) { |
|
413 | + ->filterByCallback(function($item) { |
|
414 | 414 | /** @var ChangeSet $item */ |
415 | 415 | return ($item->canView()); |
416 | 416 | }); |
@@ -615,19 +615,19 @@ discard block |
||
615 | 615 | 'campaignEditForm', |
616 | 616 | $fields, |
617 | 617 | FieldList::create( |
618 | - FormAction::create('save', _t(__CLASS__.'SAVE', 'Save')) |
|
618 | + FormAction::create('save', _t(__CLASS__ . 'SAVE', 'Save')) |
|
619 | 619 | ->setIcon('save') |
620 | 620 | ->setSchemaState([ |
621 | 621 | 'data' => [ |
622 | - 'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'), |
|
622 | + 'pristineTitle' => _t(__CLASS__ . 'SAVED', 'Saved'), |
|
623 | 623 | 'pristineIcon' => 'tick', |
624 | - 'dirtyTitle' => _t(__CLASS__.'SAVE', 'Save'), |
|
624 | + 'dirtyTitle' => _t(__CLASS__ . 'SAVE', 'Save'), |
|
625 | 625 | 'dirtyIcon' => 'save', |
626 | 626 | 'pristineClass' => 'btn-outline-primary', |
627 | 627 | 'dirtyClass' => '', |
628 | 628 | ], |
629 | 629 | ]), |
630 | - FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) |
|
630 | + FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel')) |
|
631 | 631 | ->setUseButtonTag(true) |
632 | 632 | ), |
633 | 633 | new RequiredFields('Name') |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | |
639 | 639 | // Set form action handler with ID included |
640 | 640 | $form->setRequestHandler( |
641 | - LeftAndMainFormRequestHandler::create($form, [ $id ]) |
|
641 | + LeftAndMainFormRequestHandler::create($form, [$id]) |
|
642 | 642 | ); |
643 | 643 | |
644 | 644 | // Configure form to respond to validation errors with form schema |
645 | 645 | // if requested via react. |
646 | - $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $id, $record) { |
|
646 | + $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $id, $record) { |
|
647 | 647 | $schemaId = Controller::join_links( |
648 | 648 | $this->Link('schema'), |
649 | 649 | 'campaignEditForm', |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | 'campaignCreateForm', |
691 | 691 | $fields, |
692 | 692 | FieldList::create( |
693 | - FormAction::create('save', _t(__CLASS__.'.CREATE', 'Create')) |
|
693 | + FormAction::create('save', _t(__CLASS__ . '.CREATE', 'Create')) |
|
694 | 694 | ->setIcon('plus'), |
695 | - FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) |
|
695 | + FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel')) |
|
696 | 696 | ->setUseButtonTag(true) |
697 | 697 | ), |
698 | 698 | new RequiredFields('Name') |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | |
706 | 706 | // Configure form to respond to validation errors with form schema |
707 | 707 | // if requested via react. |
708 | - $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $record) { |
|
708 | + $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $record) { |
|
709 | 709 | $schemaId = $this->Link('schema/campaignCreateForm'); |
710 | 710 | return $this->getSchemaResponse($schemaId, $form, $errors); |
711 | 711 | }); |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | return Security::permissionFailure($this); |
735 | 735 | } |
736 | 736 | if (!$record || !$record->ID) { |
737 | - $this->httpError(404, "Bad record ID #" . (int)$id); |
|
737 | + $this->httpError(404, "Bad record ID #" . (int) $id); |
|
738 | 738 | } |
739 | 739 | } else { |
740 | 740 | if (!ChangeSet::singleton()->canCreate()) { |
@@ -753,13 +753,13 @@ discard block |
||
753 | 753 | $form->saveInto($record, true); |
754 | 754 | $record->write(); |
755 | 755 | $this->extend('onAfterSave', $record); |
756 | - $message = _t(__CLASS__.'.SAVEDUP', 'Saved.'); |
|
756 | + $message = _t(__CLASS__ . '.SAVEDUP', 'Saved.'); |
|
757 | 757 | $form->setMessage($message, ValidationResult::TYPE_GOOD); |
758 | 758 | } else { |
759 | - $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', [ 'Name' => $data['Name']]); |
|
759 | + $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', ['Name' => $data['Name']]); |
|
760 | 760 | $errors = new ValidationResult(); |
761 | 761 | $errors->addFieldMessage('Name', $nameDuplicateMsg); |
762 | - $message = _t(__CLASS__.'.SAVEDERROR', 'Error.'); |
|
762 | + $message = _t(__CLASS__ . '.SAVEDERROR', 'Error.'); |
|
763 | 763 | // Need to set the form message or the field message won't show up at all |
764 | 764 | $form->setMessage($message, ValidationResult::TYPE_ERROR); |
765 | 765 | } |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | ), |
818 | 818 | 'category' => _t('SilverStripe\\Security\\Permission.CMS_ACCESS_CATEGORY', 'CMS Access'), |
819 | 819 | 'help' => _t( |
820 | - __CLASS__.'.ACCESS_HELP', |
|
820 | + __CLASS__ . '.ACCESS_HELP', |
|
821 | 821 | 'Allow viewing of the campaign publishing section.' |
822 | 822 | ) |
823 | 823 | ) |