mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #11236 from creative-commoners/pulls/5/deprecate-non-array
API Deprecate passing non-arrays to FieldList methods
This commit is contained in:
commit
cd77301de1
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\Forms;
|
namespace SilverStripe\Forms;
|
||||||
|
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list designed to hold form field instances.
|
* A list designed to hold form field instances.
|
||||||
@ -218,6 +219,10 @@ class FieldList extends ArrayList
|
|||||||
*/
|
*/
|
||||||
public function addFieldsToTab($tabName, $fields, $insertBefore = null)
|
public function addFieldsToTab($tabName, $fields, $insertBefore = null)
|
||||||
{
|
{
|
||||||
|
if (!is_array($fields)) {
|
||||||
|
Deprecation::notice('5.3.0', '$fields will need to be passed as an array in CMS 6', Deprecation::SCOPE_METHOD);
|
||||||
|
}
|
||||||
|
|
||||||
$this->flushFieldsCache();
|
$this->flushFieldsCache();
|
||||||
|
|
||||||
// Find the tab
|
// Find the tab
|
||||||
@ -270,6 +275,10 @@ class FieldList extends ArrayList
|
|||||||
*/
|
*/
|
||||||
public function removeFieldsFromTab($tabName, $fields)
|
public function removeFieldsFromTab($tabName, $fields)
|
||||||
{
|
{
|
||||||
|
if (!is_array($fields)) {
|
||||||
|
Deprecation::notice('5.3.0', '$fields will need to be passed as an array in CMS 6', Deprecation::SCOPE_METHOD);
|
||||||
|
}
|
||||||
|
|
||||||
$this->flushFieldsCache();
|
$this->flushFieldsCache();
|
||||||
|
|
||||||
// Find the tab
|
// Find the tab
|
||||||
|
Loading…
Reference in New Issue
Block a user