/** * updates the custom fields used by an article. It's actually easier to remove them all * and readd them again than check one by one if it already exists and if so updating it * and if not, add it * * @param artId * @param blogId * @param fields * @return True if successful or false otherwise */ function updateArticleCustomFields($artId, $blogId, $fields) { $customFields = new CustomFieldsValues(); // first remove the values if (!$customFields->removeArticleCustomFields($artId)) { return false; } foreach ($fields as $field) { $customFields->addCustomFieldValue($field->getFieldId(), $field->getValue(), $artId, $blogId); } return true; }