API Deprecate passing non-arrays to FieldList methods

This commit is contained in:
Steve Boyd 2024-05-14 12:43:59 +12:00
parent 4429a4999d
commit 0ba85bc1d0
1 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace SilverStripe\Forms;
use SilverStripe\ORM\ArrayList;
use SilverStripe\Dev\Deprecation;
/**
* A list designed to hold form field instances.
@ -218,6 +219,10 @@ class FieldList extends ArrayList
*/
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();
// Find the tab
@ -270,6 +275,10 @@ class FieldList extends ArrayList
*/
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();
// Find the tab