Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
how to deny new terms from being created?
fyi,i've checked out content taxonomy module (for deny) in conjunction with autocomplete deluxe (single-term), but the latter module doesn't function properly when term contains a comma.
Comment | File | Size | Author |
---|---|---|---|
#5 | taxonomy-single-tag-1983780-5-ignore-new-terms-form-validation.patch | 3.18 KB | oleg.medvedev |
#2 | taxonomy-single-tag-1983780-2-ignore-new-terms.patch | 3.19 KB | milesw |
Comments
Comment #1
dargente CreditAttribution: dargente commentedalso requested Taxonomy Single Tag be added as a widget in Content Taxonomy, but that may take awhile. It would be useful to have an option to deny new terms in this module.
Comment #2
milesw CreditAttribution: milesw commentedThis would be a nice feature. The widget works great for very large vocabularies, but sometimes those vocabularies need to be controlled (no autocreate).
Here is a patch that adds a field instance setting to ignore terms submitted by the user when they don't match any existing terms. There is also a setting to display a message to the user when their term is ignored.
Comment #3
milesw CreditAttribution: milesw commentedScreenshot of the field setting:
Comment #4
oleg.medvedev CreditAttribution: oleg.medvedev as a volunteer commentedBetter to use form_error function:
$message = format_string($instance['widget']['settings']['ignore_message'], array('%name' => $tag, '@name' => $tag));
// drupal_set_message($message, 'warning');
form_error($element, $message);
Comment #5
oleg.medvedev CreditAttribution: oleg.medvedev as a volunteer commented