Merge pull request #270 from zemiacsik/2

added support for PHP 7.2
This commit is contained in:
Robbie Averill 2018-09-07 10:26:30 +02:00 committed by GitHub
commit 1ba0e644d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

7
_config.php Normal file
View File

@ -0,0 +1,7 @@
<?php
// 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');
}

View File

@ -85,7 +85,7 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S
$handled = array_keys($editable->getDisplayFields($grid)); $handled = array_keys($editable->getDisplayFields($grid));
if($grid->getList()) { if($grid->getList()) {
$record = Object::create($grid->getModelClass()); $record = SS_Object::create($grid->getModelClass());
} else { } else {
$record = null; $record = null;
} }

View File

@ -174,7 +174,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
} }
$unsanitisedClass = $this->unsanitiseClassName($class); $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' $grid, $component, new $unsanitisedClass(), $grid->getForm()->getController(), 'add-multi-class'
); );
$handler->setTemplate($component->getTemplate()); $handler->setTemplate($component->getTemplate());

View File

@ -196,7 +196,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
$extra = $list->getExtraFields(); $extra = $list->getExtraFields();
if($extra && array_key_exists($col, $extra)) { 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();
} }
} }