From b28ded715cb2177ae4ea6dca9ea6f516a1afeac2 Mon Sep 17 00:00:00 2001 From: matej Date: Fri, 7 Sep 2018 09:46:43 +0200 Subject: [PATCH 1/3] added support for PHP 7.2 --- _config.php | 5 +++++ code/GridFieldAddNewInlineButton.php | 2 +- code/GridFieldAddNewMultiClass.php | 2 +- code/GridFieldEditableColumns.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 _config.php diff --git a/_config.php b/_config.php new file mode 100644 index 0000000..d62e0cd --- /dev/null +++ b/_config.php @@ -0,0 +1,5 @@ +getDisplayFields($grid)); if($grid->getList()) { - $record = Object::create($grid->getModelClass()); + $record = SS_Object::create($grid->getModelClass()); } else { $record = null; } diff --git a/code/GridFieldAddNewMultiClass.php b/code/GridFieldAddNewMultiClass.php index 108e434..3a341ac 100755 --- a/code/GridFieldAddNewMultiClass.php +++ b/code/GridFieldAddNewMultiClass.php @@ -174,7 +174,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL } $unsanitisedClass = $this->unsanitiseClassName($class); - $handler = Object::create($this->itemRequestClass, + $handler = SS_Object::create($this->itemRequestClass, $grid, $component, new $unsanitisedClass(), $grid->getForm()->getController(), 'add-multi-class' ); $handler->setTemplate($component->getTemplate()); diff --git a/code/GridFieldEditableColumns.php b/code/GridFieldEditableColumns.php index 996dbf9..9abe931 100644 --- a/code/GridFieldEditableColumns.php +++ b/code/GridFieldEditableColumns.php @@ -196,7 +196,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements $extra = $list->getExtraFields(); if($extra && array_key_exists($col, $extra)) { - $field = Object::create_from_string($extra[$col], $col)->scaffoldFormField(); + $field = SS_Object::create_from_string($extra[$col], $col)->scaffoldFormField(); } } From 299086ea998b57940f9159a7f3c9a47b68c1b783 Mon Sep 17 00:00:00 2001 From: zemiacsik Date: Fri, 7 Sep 2018 10:12:01 +0200 Subject: [PATCH 2/3] updated styling to follow PSR-2 --- _config.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_config.php b/_config.php index d62e0cd..e2cf530 100644 --- a/_config.php +++ b/_config.php @@ -2,4 +2,6 @@ // Ensure compatibility with PHP 7.2 ("object" is a reserved word), // with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object) -if (!class_exists('SS_Object')) class_alias('Object', 'SS_Object'); +if (!class_exists('SS_Object')) { + class_alias('Object', 'SS_Object'); +} From 1cd4d99b6cee161e53a41fe9ed07d48fcb8d07a0 Mon Sep 17 00:00:00 2001 From: zemiacsik Date: Fri, 7 Sep 2018 10:17:01 +0200 Subject: [PATCH 3/3] indent with 4 spaces instead of tab --- _config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.php b/_config.php index e2cf530..8b68529 100644 --- a/_config.php +++ b/_config.php @@ -3,5 +3,5 @@ // Ensure compatibility with PHP 7.2 ("object" is a reserved word), // with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object) if (!class_exists('SS_Object')) { - class_alias('Object', 'SS_Object'); + class_alias('Object', 'SS_Object'); }