// Check which formfields to delete $old_formfields = $entrymaskMgr->getEntrymaskFormfields($objectID); $to_del = array(); foreach ($old_formfields as $old_formfield) { $del = true; foreach ($formfields as $formfield) { if ($formfield == $old_formfield['ID']) { $del = false; } } if ($del) { array_push($to_del, $old_formfield['ID']); } } foreach ($to_del as $to_del_item) { $entrymaskMgr->removeFormfield($to_del_item); } // Check which formfields to add $new_formfields = array(); $old_formfields = $entrymaskMgr->getEntrymaskFormfields($objectID); foreach ($formfields as $formfield_idx => $formfield) { $add = true; foreach ($old_formfields as $old_formfield) { if ($formfield == $old_formfield['ID']) { $add = false; } } if ($add) { $newFormfieldId = $entrymaskMgr->addFormfield($objectID, $formfield_types[$formfield_idx], $itext['TXT_NEW_OBJECT']); $formfields[$formfield_idx] = (int) $newFormfieldId; if ($formfield_types[$formfield_idx] == 9) {