Skip to content
Snippets Groups Projects
Commit 27af98b0 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #1162226 by mr.baileys: taxonomy_term_save() should document what is in a object.

parent 94f3f368
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -532,12 +532,35 @@ function taxonomy_check_vocabulary_hierarchy($vocabulary, $changed_term) { ...@@ -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 * @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 * @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) { function taxonomy_term_save($term) {
// Prevent leading and trailing spaces in term names. // Prevent leading and trailing spaces in term names.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment