Unless I'm missing something, the only autocomplete option we have for taxonomy terms is the Term reference: Autocomplete term widget (tagging). This widget allows to reference exisiting terms, but will also add non-existing terms to the vocabulary.
I think it would be very handy when one can disallow the creation of new terms through that autocomplete widget, so that only exisiting terms can be referenced.
Alternatively: This is already possible with Entity Reference (https://drupal.org/project/entityreference) or Content taxonomy (https://drupal.org/project/content_taxonomy) as mentioned in the issue comments.
Started a new issue, but I see this feature has been proposed before: http://drupal.org/node/526122#comment-1836544 .
Comment | File | Size | Author |
---|---|---|---|
#23 | taxonomy.zip | 17.4 KB | sibany |
#17 | AutoCompletInD6.png | 24.71 KB | ThePickwickProject |
#5 | 1078878-DisableAutoCreation-D7-UTF-8.patch | 2.27 KB | j.stuyts |
#4 | 1078878-DisableAutoCreation-D7.patch | 4.53 KB | j.stuyts |
#3 | 1078878-DisableAutoCreation-D7.patch | 4.53 KB | j.stuyts |
Comments
Comment #1
j.stuyts CreditAttribution: j.stuyts commentedI also would love to see an option to disable creation of terms and forums completely. I do not want the users of my site to accidentally create new terms or forums when they enter an incorrect title in the field.
I don't see any widget type settings, so I guess it is not possible to add a checkbox to indicate whether creation of terms/forums is allowed or not. To solve it a new widget type probably has to be introduced: Term reference: Autocomplete term widget (tagging, no creation).
Comment #2
j.stuyts CreditAttribution: j.stuyts commentedOne more thing: the reason I need to use an autocomplete field and cannot use a selection list, is that a selection list does not pick up new terms that are created during editing of the referencing node. This allows a more natural workflow for the user:
Comment #3
j.stuyts CreditAttribution: j.stuyts commentedHere is a patch that adds a field setting to term reference fields that allows the user to disable autocreation of terms for unknown values.
Comment #4
j.stuyts CreditAttribution: j.stuyts commentedChanged encoding of patch to UTF-8 (was UTF-16).
Comment #5
j.stuyts CreditAttribution: j.stuyts commentedSorry, uploaded UTF-16 version of file again. Here is the patch in UTF-8.
Comment #6
Steven Jones CreditAttribution: Steven Jones commentedFunctionally this patch works, so thanks for contributing it, but:
Comment #7
Steven Jones CreditAttribution: Steven Jones commentedActually, although this is a lovely core patch, I wonder if this would be better as a contrib project?
Comment #8
Steven Jones CreditAttribution: Steven Jones commentedActually the Content taxonomy project does the trick, and core can go about its merry business!
Comment #9
j.stuyts CreditAttribution: j.stuyts commentedThanks for pointing us to the Content Taxonomy project. I will check it out.
Comment #10
agentrickardI would still like to see this behavior accounted for in Drupal 8 and I think it is properly called a bug in the module design. Yes, we can fix it in contrib, but it seems like an oversight that needs correcting.
Marking needs work due to the latest reviews and the recent
/core
change.Comment #11
carsonblack CreditAttribution: carsonblack commentedI would also like to see this in core. It is only a slight, but very useful, modification of the functionality of this type of widget that totally makes sense to be there (it makes sense that if you're going to enable some functionality that you should be able to disallow it as well). Permissions could be the solution to that, but there is an exception, read on.
Also, when using this widget with a hierarchical taxonomy, something you can do using core, it really doesn't make sense to allow the use of this widget for adding new terms to the taxonomy because they would not be able to stick the term in the right spot/level in the taxonomy, but it is a very nice way to select terms from that taxonomy. But I still want to give that same user the ability to edit that hierarchical taxonomy via the taxonomy interface. #2 kind of points this out as well. There are also use cases where the user that is entering content doesn't really care about the hierarchy of the taxonomy while they are entering a new piece of content, but the site builder is relying on the integrity of the hierarchy to be maintained. Offering some very long list of hierarchical taxonomy list in a select as an alternative to this is really cumbersome UX.
It seems heavy handed and overkill to have to rely on a contrib module for a such a simple little additional checkbox that could go a long way to helping core content management functionality and usability.
Comment #12
carsonblack CreditAttribution: carsonblack commentedQuestion: so the patch in #5 is for D7 or D8? I would like to test it.
Comment #13
agentrickardThe patch is against D7 and needs a re-roll against D8.
Comment #14
amitaibu"Auto create" is a checkbox in #1801304: Add Entity reference field, which will deprecate taxonomy term field.
Comment #15
Frank Ralf CreditAttribution: Frank Ralf commentedThanks for the pointer - and the work!
Comment #16
rp7 CreditAttribution: rp7 commentedBeen almost 2 years now - any chance this can finally get in?
Patch in #5 works.
Comment #17
ThePickwickProject CreditAttribution: ThePickwickProject commentedThat would be really nice.
fyi - We're currently migrating a D6 site and apparently this feature existed in the past (see attachment).
Comment #18
agentrickardI think this may already be in D8. See this code in \Drupal\taxonomy\Plugin\entity_reference\selection\TermSelection:
And this in entity_reference_field_presave():
Can someone track down when this was committed? If so this is a duplicate now and just needs a backport to D7.
Comment #19
TravisCarden CreditAttribution: TravisCarden commentedRe: #18. This was added in #1801304: Add Entity reference field. It came in the form of a whole module, so a straight backport to D7 won't be possible. It would be nice to have an intermediate solution in D7, but we can always just use the Entity reference module in contrib, too. (Just use its entity reference field in place of core's term reference field.)
Comment #20
Cyclodex CreditAttribution: Cyclodex commentedThis issue is getting older...
I updated the issue summary but I am not sure what the task is here now.
We have several stuff in here, modules which would fix it already like:
https://drupal.org/project/content_taxonomy
https://drupal.org/project/entityreference
and D8 has it also already in there with Entity Reference
can we close this or do you want to provide a proper patch for D7 to fix it? (see comment 6 https://drupal.org/node/1078878#comment-4292112)
Comment #20.0
Cyclodex CreditAttribution: Cyclodex commentedupdating issue summary - its possible with entity reference
Comment #20.1
Cyclodex CreditAttribution: Cyclodex commentedadding content_taxonomy as possible alternative
Comment #21
pratip.ghosh CreditAttribution: pratip.ghosh commentedDoes anyone plan to release a patch for the latest version of Drupal? Cuz this one is giving error while patching...
Comment #22
pratip.ghosh CreditAttribution: pratip.ghosh commented5: 1078878-DisableAutoCreation-D7-UTF-8.patch queued for re-testing.
Comment #23
sibany CreditAttribution: sibany commentedHey pratip.ghosh,
am using drupal 7.28
its good , patch OK and work perfect!
anyway i'have attched the taxonomy.module file in zip ,
just replace it with the one you have and hit the update button after you put site on maintenance mode ;)
"Make Back-up of the tox.. file first"
Comment #24
davidwhthomas CreditAttribution: davidwhthomas commentedHere's another way of limiting creation of new terms in a taxonomy_autocomplete field widget.
This one doesn't require a core patch and uses a custom module instead.
Comment #25
mark_fullmerThanks for that solution, davidwhthomas! Building off your code, which defines the ability to add via autocomplete globally to all taxonomies, via the "administer taxonomy", I've written a module that defines individual permissions per existing taxonomy:
https://www.drupal.org/sandbox/markfullmer/2492455
Comment #26
michel.settembrino CreditAttribution: michel.settembrino as a volunteer commentedAlternative solution: see https://www.drupal.org/project/content_taxonomy