Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294944

Term field widget "Autocomplete" not saving terms with a name of "0"

$
0
0

I found that the "Autocomplete term widget (tagging)" field widget does not save the referenced term, if the name of the term is "0".
This applies to both cases, in which a term with such a name does exist, and to when a term does not yet exist and should be created.

The problem is in the taxonomy_autocomplete_validate() function (line 1639 of taxonomy.module):

<?php
if ($tags = $element['#value']) {
?>

If i change that line to:

<?php
 
if ($element['#value'] !== null) {
   
$tags = $element['#value'];
?>

Then it works fine, both for saving existing terms with a name of "0" and for creating new terms with the name of "0".

Not sure if the "!== null" is the best option - but it does solve it.


Viewing all articles
Browse latest Browse all 294944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>