/** * removes a custom field, but also all the values that have been created * based on this field and that have been assigned to different articles. * Otherwise, we would have data which is not linked to any article... but if still * needed, set the second parameter to false * * @param id * @param deleteValues * @return Returns true if successful or false otherwise */ function removeCustomField($id, $deleteValues = true) { $query = "DELETE FROM " . $this->getPrefix() . "custom_fields_definition\n\t\t\t WHERE id = {$id}"; $result = $this->Execute($query); if (!$result) { return false; } if (!$deleteValues) { return true; } // remove the values that were associated to this field $fieldValues = new CustomFieldsValues(); return $fieldValues->removeCustomFieldValues($id); }