added support for PHP 7.2

This commit is contained in:
matej 2018-09-07 09:46:43 +02:00
parent 30ae7e4037
commit b28ded715c
4 changed files with 8 additions and 3 deletions

5
_config.php Normal file
View File

@ -0,0 +1,5 @@
<?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();
} }
} }