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.
version 5.1
I'm using the view module / taxonomy to organize site content into a number of categories. When I am editing the view, some of the terms do not show up in the "add fields" drop down menu. (Taxonomy: Terms for FOO)
Right now it lists 8 terms, but there are 13 categories that should be listed. They are all applied to the same content type, but other than that the missing terms are diverse. Some allow freetagging, others don't.
Any idea why this might be?
Comment | File | Size | Author |
---|---|---|---|
#63 | views-DRUPAL-5.missing-terms.patch | 831 bytes | sun |
#39 | views_taxonomy.inc_.patch | 657 bytes | owahab |
#28 | patch.txt | 466 bytes | Sara Adams |
#10 | optional_vocab.1_1.patch | 762 bytes | yhager |
#9 | optional_vocab.1_0.patch | 762 bytes | yhager |
Comments
Comment #1
gmak CreditAttribution: gmak commentedI am getting the same behaviour. I have two taxonomy term filters, each taxonomy has three terms. But, only two of the terms show up in the lists.
Comment #2
yhager CreditAttribution: yhager commentedI found out that the first term is deleted if the vocab is not required. The attached patch worked for me.
Comment #3
gmak CreditAttribution: gmak commentedpatch worked for me too. thanks yhager!
Comment #4
yhager CreditAttribution: yhager commentedComment #5
gregglesThe patch failed for me but the bugfix worked, so I've rerolled it.
I'm not 100% sure this is the "right" way to do it, but it seems to work. It also seemed to introduce the side effect that my top term was selected, though that filter wasn't enforced.
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedgreggles: No patch attached.
Comment #7
gregglesheh
Comment #8
yhager CreditAttribution: yhager commentedHere's a revised patch, addressing the issue mentioned on comment #5.
Comment #9
yhager CreditAttribution: yhager commentedHere's a revised patch, addressing the issue mentioned on comment #5.
Comment #10
yhager CreditAttribution: yhager commentedHere's a revised patch, addressing the issue mentioned on comment #5.
Comment #11
z.stolar CreditAttribution: z.stolar commentedFor patchophobic, a temporary bypass can be to use the "Taxonomy: Term" filter which lists all the terms, in a big long list.
Comment #12
z.stolar CreditAttribution: z.stolar commentedThe patch works for me with no visible side effects.
Thanks yhager.
Comment #13
nterbogt CreditAttribution: nterbogt commentedJust a quick question... can anyone tell me why the author deletes the first item in the first place?
Comment #14
yched CreditAttribution: yched commented@nterbogt : the intent here is to remove the ' option that is present in taxonomy selectors for non-required vocabularies, but is not relevant in the views filters context. Then forgetting to check if the vocab actually is required or not is a typo / negligence, I guess :-)
Let's mark this RTBC
Comment #15
ShutterFreak CreditAttribution: ShutterFreak commentedSubscribing.
Comment #16
merlinofchaos CreditAttribution: merlinofchaos commentedyched meant to say
<All>
option but his < got eaten. =)Yes, this patch is RTBC, I just need to get back around to this. Hopefully soon.
Comment #17
jpsalter CreditAttribution: jpsalter commentedI'm having this problem w/ 5.x-1.6-beta5 too. Should the Version of this issue be changed?
Comment #18
yched CreditAttribution: yched commentedIt definitely should. This a 1.6 bug only, AFAIK.
Comment #19
criz@drupal.org CreditAttribution: criz@drupal.org commentedalso missed the first taxonomy term in my exposed filters (and in views admin forms). But this patch worked for me, many thx!
Comment #20
buddaSolution worked for me. bang it into CVS.
Comment #21
FiNeX CreditAttribution: FiNeX commentedI've test the patch... the first term is still not visibile.
Comment #22
dabro CreditAttribution: dabro commentedThe latest patch fixed my terms not showing up, Thanks
Comment #23
tom friedhof CreditAttribution: tom friedhof commentedlatest patch worked for me
Comment #24
timothyf CreditAttribution: timothyf commentedTo those of you who are reporting that this patch is not working, try emptying the cache_views table after applying the patch. That worked for me.
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous commentedLatest patch also fixes this issue for me.
txcrew
Comment #26
merlinofchaos CreditAttribution: merlinofchaos commentedFinally committed to -dev. =)
Comment #27
(not verified) CreditAttribution: commentedComment #28
Sara Adams CreditAttribution: Sara Adams commentedWith 5.4, a fix in taxonomy was applied (http://drupal.org/node/180109). This means the first entry for optional filters does not have to be removed anymore. Attached a patch that establishes the wanted result.
Without this patch, the first taxonomy term doesn't show up, which is most definitely undesired behaviour.
Comment #29
merlinofchaos CreditAttribution: merlinofchaos commentedThis needs to be fixed so that it doesn't store the entire taxonomy tree in the views cache anyway.
Comment #30
drupalprojects CreditAttribution: drupalprojects commentedI've used 1.6 and first term still won't show in terms list
Comment #31
cghobbs CreditAttribution: cghobbs commentedI'm using 1.6 and the above patch worked for me without any visual side effects. But like merlinofchaos mentions this may not be the right way to do it anyway.
Comment #32
catchLots of duplicates of this so changing status back to patch to make it more visible.
Comment #33
sagannotcarl CreditAttribution: sagannotcarl commentedPatch from #28 applies cleanly and solves the issue for me.
Comment #34
xurizaemonpatch in comment #28 works fine for me
+1 for this being released
Comment #35
catchThis patch is already committed, there just isn't an official release which includes it yet (because the 1.7 release depends on more than just this patch). I marked this back to a patch status to make it easier to find but that seems to be giving the impression that it needs testing/lobbying to get committed - so back to fixed I guess.
Comment #36
tjharman CreditAttribution: tjharman commented[edit: Ignore - I forgot to clear the views cache]
This isn't working for me, not even the patch in #28
I am using views-1.6 and Drupal 5.7
My Taxonomy Term has a space in it -> "Friends Only", would that be the problem?
Regards,
tim
Comment #37
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #38
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedsubscribing
Comment #39
owahab CreditAttribution: owahab commentedThe first term of a vocabulary that's not required still doesn't show up in Views. The committed patch didn't fix the problem.
Issue #180109: Only taxonomy term selected by default when there is only one broke the behavior of Views:
Comment #40
patacra CreditAttribution: patacra commentedPerfect, it's working fine for me!
But I had to clear the cache once or twice...
Comment #41
svihel CreditAttribution: svihel commentedPerfect solution!
It even removed the "none" option which I was trying to get rid of for quite a long time. Hopefully this will stay the same in final version.
Thank you.
Comment #42
marcj CreditAttribution: marcj commentedHi Im new at this views thing Im getting the same problem with the first
term not displaying in my filter. I see the patch, I have no idea where to
put that code or how to implement that fix!
marcj
Comment #43
Les LimThe patch in #39 works for me, with no apparent side effects.
@marcj: a good place to start learning about patches is http://drupal.org/patch. There's also a video on how to apply patches here: http://drupal.org/node/132745
Comment #44
marcj CreditAttribution: marcj commentedComment #45
yhager CreditAttribution: yhager commentedmarcj: I don't think you should go around patching files if you don't understand this. You will probably get your site into unworkable state sooner or later, and nobody will be able to help you.
These patches are meant for coders to send information to each other about a problem fix.
When a patch is approved and is good and working, it usually goes into the module - so you don't need to patch anything if you need a STABLE system.
Comment #46
marcj CreditAttribution: marcj commentedThanks for the link on patches, this is obviously a complex procedure (or not) what are the chances of breaking my website doing this I have weeks of work into this project I would hate to break it at this point in time.
Comment #47
buddaPatch in 39 works for me too.
Comment #48
pounard+1 for patch #39
I searched myself and I made the same patch without looking at this page. This is the right one.
Edit: I found something paradoxical
Original code:
This code says: if our vocabulary IS NOT required, then we CANNOT filter nodes which don't have any terms. But this is a nonsense, I want to be able to filter my view to display only nodes which does not have any terms of this vocabulary.
Should be:
And this one says: if our vocabulary IS required, then we cannot filter node which don't have any terms. This is perfectly legal because in this case, it's absolutely impossible to have node without any terms (except in incoherent database state).
Comment #49
merlinofchaos CreditAttribution: merlinofchaos commentedpounard: Actually, what that piece of code is saying is "If this vocabulary is not required, remove the '' entry that is added by the taxonomy module.
The problem is, as I've said before, this whole piece of code is wrong. Yes, the patch in #39 addresses this symptom of the issue, but it does not address a deeper underlying issue which is that the taxonomy form shouldn't be stored in the Views cache. This is an issue that I'm still waiting for someone to write a proper patch and it's the only reason I have not release a Views 1.7. There will not be a 1.7 until this issue is addressed.
Comment #50
pounardOk, but does the '-- none selected --' has sense when the 'all' option is there ? In the case where the vocabulary is required, '-- node selected--' and 'all' does the same stuff ? Whatever it is, 'none' with no terms does not exists, so use the 'all' which "disable" the filter, and use the 'none' which disable the filter, or filter the nodes with no terms (which does not exists) is a nonsense.
There is more sense to keep the 'none' and 'all' when taxonomy is not required, and remove the 'none' and keep only the 'all' in case it is required.
If the 'none' says "the user dont want to filter this field", I'm wrong, but in this case the 'all' does exactly the same stuff. But if the 'none' says "the user want the nodes with no terms", then the current code is illogical.
Edit: typo.
Comment #51
merlinofchaos CreditAttribution: merlinofchaos commentedI'm sorry, replace all with 'none selected'. There isn't an all, that's exposed filters and it's added later, and my brain was conflating the two. There should definitely not be a 'None' option. That's very specific to the taxonomy selector UI in node editing.
Comment #52
pounardI noticed this, and this is really confusing to have a 'none selected' and 'all' which does the same thing. I think the 'none' has just nonsense when the 'all' is added by the view module.
Comment #53
zcferres CreditAttribution: zcferres commentedPatch 39 worked for me. Why hasn't this been committed?
Comment #54
KarenS CreditAttribution: KarenS commented@zcferres, #49 explains why it isn't committed.
@merlin, I didn't realize this was the holdup. I have also been struggling with custom form elements that get 'stuck' in the cache and trying to figure out what to do about them. (In my case I have been trying to add custom date form elements to views).
I think if we narrow the problem down, it only affects filters that use form elements. Those forms (and all their possible options) get cached in the view if the view is cached, which not only fills up the cache but also screws up FAPI processing.
One simple option is to automatically mark views that use filter forms to be uncacheable (as we do for any view with arguments). This would be a pretty simple fix (and it's the way I fixed it for the Date module).
A more complicated fix would be a flag of some kind on views that use filter forms to omit the form from the cached view and to re-create a fresh copy of the form when the view is viewed. That would obviously be more complicated, but would allow you to cache views that have filters.
Does this analysis sound right to you, or am I missing anything? And if I have this right, which way do you prefer to go?
Comment #55
merlinofchaos CreditAttribution: merlinofchaos commentedIt's not the individual view cache, it's the views data cache. It happens when you get something like this:
FOr taxonomy it's uglier than that since it actually goes and uses taxonomy.module's form widget, which seemed like a good idea at the time but turns out not to be.
Views supports replacing #options with a string which will be a function name to get the options in realtime. That's the recommended way to implement that.
Comment #56
KarenS CreditAttribution: KarenS commentedThe size of #options is not the only problem -- FAPI validation doesn't work right either and I've just generally had a hard time getting custom form elements to work correctly unless they are so simple that they don't use #process or #validate or any of the other FAPI processes. Try adding a #process function to a filter element -- it only gets triggered when the view is saved, not when the form is displayed, which really limits what you can do with it. I think this is why I could never get the GMap widget working right as an exposed views filter (I set it up so you could click on a map and use the location as the filter for your view, but I had to invalidate the data cache each time or the javascript wouldn't work).
And I know that part of this is getting stuck in the data cache, but other things are stuck in the view cache because some of my form problems go away if I keep the view from being cached. I've gone around and around trying to figure out where my forms were getting broken, I don't pretend that I have all the right answers, I just know fancy forms don't work well as Views filters.
It seems to me that substituting the options is not going to be as robust a solution as keeping the form element out of the cache altogether and generating it at runtime.
But maybe you only want to fix the #options problem since this is Views 1 and we now have Views 2, and that's fair enough, so I can try to roll a patch for that once I figure out how to get the substitutions working.
Comment #57
merlinofchaos CreditAttribution: merlinofchaos commentedData cache? View cache? Views only really has two caches here. There's the hook_views_tables() stuff and related, and there's the query cache. You've got me a little confused, now.
And yes, Fapi 2 doesn't deal at all with $_GET stuff, which is why #process and #validate don't work at all. Nothing to be done about it except use Views 2 instead.
Comment #58
KarenS CreditAttribution: KarenS commentedThe crux of what I was trying to say is that I can get some very fancy form elements working as Views filters one way or another if I can keep them out of the cache (I can retrieve the $_GET in my #process, or whatever I need to do). When they get stuck in the cache, only the simplest things will work.
But I've drug this issue far enough off track. I'm sorry for going off on a tangent. You only want to fix #options, so we should get back to that. Forget the rest of it.
Comment #59
merlinofchaos CreditAttribution: merlinofchaos commentedHm. Well you probably should be able to create a function that returns the entire fapi gadget. That makes sense.
Comment #60
sunCan someone please create a summary of this issue that exactly states what has been changed in the meantime, the effects of these changes, and what has to be done now?
Comment #61
merlinofchaos CreditAttribution: merlinofchaos commentedThe summary as I understand it: (And there's a new issue for this marked 1.7 pre-req #2 or something along those lines):
The gadget for taxonomy selection needs to be completely rewritten so that it does not utilize the taxonomy default select gadget, which is coded very specifically for selecting taxonomy terms on a node. Instead, Views needs to examine the vocabulary and determine if it should present an auto-complete or a select (or maybe even create multiple filters so it can present both, allowing people to choose; this is really valuable for exposed filters).
Then it needs to ensure that the select list is generated when the form gadget is rendered, not when it is embedded into the views data. This can be accomplished wiht '#options' => 'function_name' and function_name() will return the list of taxonomy terms.
Comment #62
MichelleThe patch wasn't quite right due to a change in Drupal 5.4. Here is what the code should look like:
It's on line 243 of views_taxonomy.inc in 1.6.
Michelle
Comment #63
sunThose lines would translate into attached patch - at least I hope so.
Comment #64
sunBetter title.
Comment #66
metareason CreditAttribution: metareason commentedPatch in #63 works for me.
Comment #67
Squirrelly CreditAttribution: Squirrelly commentedSubscribing.
Comment #68
sunPlease do not only subscribe, please tell whether you applied the patch, and whether it worked for you, without breaking any other existing views.
Comment #69
Squirrelly CreditAttribution: Squirrelly commentedSorry. Actually I previously applied the fix as in #300898: First taxonomy term dropped from select lists and that has been working for me.
However that was recently marked as a duplicate of this issue, and as of # 62 here I see there is a similar but slightly more involved (and hopefully more correct) fix.
I will be trying that fix and see if it works as well or better.
In the meantime I wished to track this issue both for finding it again when I have more info, and for any future updates.
Hopefully that's a little more informative.
Comment #70
Bencio CreditAttribution: Bencio commentedPatch in #63 worked for me
Comment #71
fallsemo CreditAttribution: fallsemo commentedPatch in #63 worked for me after clearing views cache.
Thanks sun
Comment #72
Summit CreditAttribution: Summit commentedSubscribing, will this patch go in please?
greetings, Martijn
Comment #73
sunCommitted, thanks for testing.
@all: If you can, please test some other patches in the queue - thanks.
Comment #75
robomalo CreditAttribution: robomalo commentedFirst term is missing for me as well as of today. All modules and core are up to date. (Drupal 5)
Comment #76
greggles@robomalo - This was committed but hasn't been included into a point release yet: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/views/modul...
Maybe try out the dev version.
Comment #77
glennnz CreditAttribution: glennnz commentedMichelle
This patch (#62) works fine, but I would like to retain the -Please select- at the top of my select box. How can I get that back?
Thanks
Glenn
Comment #78
digidoo CreditAttribution: digidoo commentedHi there!
#63 works for me too, marvellous, thanks
Comment #79
alexkb CreditAttribution: alexkb commentedglennnz: at the top of mine, it would normally say "- None Selected -", not "- Please Select -". Is None selected what you mean? If you need that feature, just select all items, and then select the "Is None of" Operator.
Also, just to add to this (it wasn't obvious to me): after applying the patch, you need to either truncate your cache_views table, or disable and then re-enable the views modules.
Thanks for the patch!
Comment #80
riju.aikkal CreditAttribution: riju.aikkal commentedI am using D7 and now I am experiencing a problem that taxonomy term is not displaying in Filter criteria of view. Please sent solution to solve the issue.
Comment #81
MichelleThe differences between 5.x and 7.x are so huge I can't imagine it could possibly be the same bug and, besides, this one was fixed. I suggest you start a new issue for your problem and be sure to read the instructions for submitting a new issue.
Michelle