diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-06-06 05:55:30 -0400 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-06-06 05:55:30 -0400 |
commit | 276209f512c4bf6d8c7cf54b4859db17bb472ba5 (patch) | |
tree | cec2921454f4a4715df81e5a4da44197ee95ede2 /modules/taxonomy | |
parent | df642fea996fbfb85fe4ed3b8ec1989c9aaa2683 (diff) | |
download | brdo-276209f512c4bf6d8c7cf54b4859db17bb472ba5.tar.gz brdo-276209f512c4bf6d8c7cf54b4859db17bb472ba5.tar.bz2 |
- Patch #1162226 by mr.baileys: taxonomy_term_save() should document what is in a object.
Diffstat (limited to 'modules/taxonomy')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index c171c0692..dc2847d37 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -532,12 +532,35 @@ function taxonomy_check_vocabulary_hierarchy($vocabulary, $changed_term) { } /** - * Save a term object to the database. + * Saves a term object to the database. * * @param $term - * A term object. + * The taxonomy term object with the following properties: + * - vid: The ID of the vocabulary the term is assigned to. + * - name: The name of the term. + * - tid: (optional) The unique ID for the term being saved. If $term->tid is + * empty or omitted, a new term will be inserted. + * - description: (optional) The term's description. + * - format: (optional) The text format for the term's description. + * - weight: (optional) The weight of this term in relation to other terms + * within the same vocabulary. + * - parent: (optional) The parent term(s) for this term. This can be a single + * term ID or an array of term IDs. A value of 0 means this term does not + * have any parents. When omitting this variable during an update, the + * existing hierarchy for the term remains unchanged. + * - vocabulary_machine_name: (optional) The machine name of the vocabulary + * the term is assigned to. If not given, this value will be set + * automatically by loading the vocabulary based on $term->vid. + * - original: (optional) The original taxonomy term object before any changes + * were applied. When omitted, the unchanged taxonomy term object is + * loaded from the database and stored in this property. + * Since a taxonomy term is an entity, any fields contained in the term object + * are saved alongside the term object. + * * @return - * Status constant indicating if term was inserted or updated. + * Status constant indicating whether term was inserted (SAVED_NEW) or updated + * (SAVED_UPDATED). When inserting a new term, $term->tid will contain the + * term ID of the newly created term. */ function taxonomy_term_save($term) { // Prevent leading and trailing spaces in term names. |