aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt1
-rw-r--r--engine/lib/entities.php38
2 files changed, 39 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 3d64def69..074aa6c62 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@ Version 1.8.0
Generic API changes:
* Added elgg_instanceof().
+ * Added remove_subtype() and update_subtype().
UI/UX API changes:
* Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs().
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index fd46b062d..e3fa0cb52 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1462,6 +1462,44 @@ function add_subtype($type, $subtype, $class = "") {
}
/**
+ * Removes a registered subtype
+ *
+ * @param string $type
+ * @param string $subtype
+ */
+function remove_subtype($type, $subtype) {
+ global $CONFIG;
+
+ $type = sanitise_string($type);
+ $subtype = sanitise_string($subtype);
+
+ return delete_data("DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE type = '$type' AND subtype = '$subtype'");
+}
+
+/**
+ * Update the registered information
+ *
+ * @param string $type
+ * @param string $subtype
+ * @param string $class
+ */
+function update_subtype($type, $subtype, $class = '') {
+ global $CONFIG;
+
+ if (!$id = get_subtype_id($type, $subtype)) {
+ return FALSE;
+ }
+ $type = sanitise_string($type);
+ $subtype = sanitise_string($subtype);
+
+ return update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes
+ SET type = '$type', subtype = '$subtype', class = '$class'
+ WHERE id = $id
+ ");
+}
+
+
+/**
* Update an existing entity.
*
* @param int $guid