Closed (duplicate)
Project:
Primary Term
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Mar 2008 at 06:03 UTC
Updated:
13 Oct 2010 at 19:22 UTC
The menu needs to remove [none] when it occurs in the options list, since you add it below. Otherwise you get 2+ [none] choices. Looks like the code was there at some point and got commented out. Here's the patch.
--- primary_term.module 11 Nov 2007 23:02:23 -0000 1.1.1.1
+++ primary_term.module 6 Mar 2008 05:59:44 -0000
@@ -48,9 +48,9 @@
foreach($form['taxonomy'] as $vid => $vocab){
if(in_array($vid, $vids)){
if(is_array($vocab['#options'])){
- if(strlen(trim($vocab['#options']))){
- // not sure why we have the line below. from old days.
- // unset($vocab['#options'][0]);
+ if( !is_object($vocab['#options'][0]) ) {
+ // remove the <none> choice for vocabularies that aren't Required
+ unset($vocab['#options'][0]);
}
$terms = $terms + $vocab['#options'];
}
Comments
Comment #1
therzog commentedIn drupal 5.4+, the "none" term is keyed with an empty string, not 0. Use this patch instead:
Comment #2
sethcohn commentedThis entire section of code needs work, the array addition should be a merge, for example.
If someone wants to create a working patch that gets an RTBC, I'll commit it.
See #287040: terms missing from Primary term select box
and
#239608: Setting primary term to <none> broken
Comment #3
brianV commentedTaken care of when #372809: Using with Hierarchical Select broken was committed.