From 7d39887df3e19e8089b007991ae40ca23a0bc205 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 28 May 2009 08:40:23 +0000 Subject: [PATCH] MINOR: optimized code when deleting multiple fields --- code/editor/FieldEditor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/editor/FieldEditor.php b/code/editor/FieldEditor.php index 09969a7..7661fa4 100755 --- a/code/editor/FieldEditor.php +++ b/code/editor/FieldEditor.php @@ -127,10 +127,10 @@ class FieldEditor extends FormField { } // remove the fields not saved - foreach($missingFields as $removedField) { - if(is_numeric($removedField->ID)) { - // check we can edit this - if($this->canEdit()) { + if($this->canEdit()) { + foreach($missingFields as $removedField) { + if(is_numeric($removedField->ID)) { + // check we can edit this $removedField->delete(); } }