From 0ba85bc1d00281c79f8623186b2e5ba6a3ec2929 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 14 May 2024 12:43:59 +1200 Subject: [PATCH] API Deprecate passing non-arrays to FieldList methods --- src/Forms/FieldList.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index 7e8a80cd1..85143cf13 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -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