summaryrefslogtreecommitdiff
path: root/modules/taxonomy
diff options
context:
space:
mode:
authorDries <dries@buytaert.net>2011-11-20 22:51:41 -0500
committerDries <dries@buytaert.net>2011-11-20 22:51:41 -0500
commitefe039b555d9437ee5111f1c80cf1a3f6e9715f4 (patch)
tree1936c4d4871b763f96b9596b27b5dfc73d427f2c /modules/taxonomy
parent2ccd470ed20ef7668dd84d599397d53f25bc4302 (diff)
downloadbrdo-efe039b555d9437ee5111f1c80cf1a3f6e9715f4.tar.gz
brdo-efe039b555d9437ee5111f1c80cf1a3f6e9715f4.tar.bz2
- Patch #1337124 by xjm: improve API documentation for taxonomy_autocomplete().
Diffstat (limited to 'modules/taxonomy')
-rw-r--r--modules/taxonomy/taxonomy.pages.inc30
1 files changed, 29 insertions, 1 deletions
diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc
index 2a8d961a3..26304136d 100644
--- a/modules/taxonomy/taxonomy.pages.inc
+++ b/modules/taxonomy/taxonomy.pages.inc
@@ -77,7 +77,35 @@ function taxonomy_term_feed($term) {
}
/**
- * Helper function for autocompletion
+ * Page callback: Outputs JSON for taxonomy autocomplete suggestions.
+ *
+ * Path: taxonomy/autocomplete
+ *
+ * This callback outputs term name suggestions in response to Ajax requests
+ * made by the taxonomy autocomplete widget for taxonomy term reference
+ * fields. The output is a JSON object of plain-text term suggestions, keyed by
+ * the user-entered value with the completed term name appended. Term names
+ * containing commas are wrapped in quotes.
+ *
+ * For example, suppose the user has entered the string 'red fish, blue' in the
+ * field, and there are two taxonomy terms, 'blue fish' and 'blue moon'. The
+ * JSON output would have the following structure:
+ * @code
+ * {
+ * "red fish, blue fish": "blue fish",
+ * "red fish, blue moon": "blue moon",
+ * };
+ * @endcode
+ *
+ * @param $field_name
+ * The name of the term reference field.
+ * @param $tags_typed
+ * (optional) A comma-separated list of term names entered in the
+ * autocomplete form element. Only the last term is used for autocompletion.
+ * Defaults to '' (an empty string).
+ *
+ * @see taxonomy_menu()
+ * @see taxonomy_field_widget_info()
*/
function taxonomy_autocomplete($field_name, $tags_typed = '') {
$field = field_info_field($field_name);