Cloud weight field field is required but no drop down is given.
samirnassar - September 17, 2008 - 17:39
| Project: | Views Cloud |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
When attempting to create a view with the cloud style I am unable to save the view because the cloud weight field setting is blank. The error message is:
Cloud weight field field is required.

#1
Can anyone confirm this? Alternatively, am I missing something in the documentation?
#2
The cloud weight field is empty for me as well...
#3
Documentation? Where did you find that? I cannot get this working either. Views2, Drupal 6.4
#4
At present, only fields with numeric or date values can be chosen for the weight. That means that you must have at least one field in your view that contains a numeric or timestamp value.
#5
I added "Taxonomy Weight" as a field with numeric value. Is still didn't show up as an option. I also managed to break the website by clicking around in the view and then saving it (cloud style still set even with weight field empty). When the block tries to display, get a php error which breaks any page the block is on (in my case because I wasn't careful, was set to display on all). Managed to switch the block off with a quick db hack.
#6
Hmmm. Thanks, I'll spend a bit more time investigating this -- I'm not sure why it would behave so differently.
To clarify, what version of Views are you using?
#7
I'm seeing the same thing. Since I was halfway sure I remembered seeing the cloud weight dropdown populated when I was playing around with a view last week, I tried reverting to different versions of Views. However, I still get no available fields for cloud weight even on numeric fields with:
views-6.x-2.0-rc3
views-6.x-2.0-rc4
views-6.x-2.x-dev (Oct. 2)
This site is not in production, so if I there's anything I can do to help in debugging, let me know.
#8
wu-wei, I have the sneaking suspicion that it's a problem in the mechanism used to recognize what fields are, in fact, numeric. I'll see if I can tighten that up and get a fix pulled together. Thanks!
#9
I think your sneaking suspicion is spot-on. Just for grins I changed line 22 of views_cloud_plugin_style_cloud.inc
to
if (true or in_array($handler->definition['handler'] ...
And the dropdown is now populated. Of course, now the admin must use the brain to determine if the chosen field is makes sense as a weight.
Thanks for the module and the support :) I think seeing your next diff will enlighten me on some fundamental Drupal internals.
#10
Same problem. Subscribing.
#11
Subscribing. I set it to critical, since I do not see how the module could be used if this is not working.
#12
still not fixed?
#13
subscribing
#14
Same problem. Subscribing
#15
Have you tried to make it with this exported view? It's working.
Szy.
#16
Thanks. I wasn't able to get it to work, but may have not done it right. I imported the view without making any changes, then went to the corresponding path for the page and got: Page not found. The requested page could not be found. I do have a large number of taxonomy terms which I thought it might automatically hook into, but maybe not.
#17
I haven't checked page display, but block was working fine for me.
Szy.
#18
While taxonomy weight does not seem to work, items associated with node stats seem to.
http://drupal.org/node/319499#comment-1054375
Edit- I would like to be able to sort on the actual number of occurances of a Taxonomy term too. Any ideas on how?
#19
@ #18 -- I can confirm that node stats do work properly.
#20
Little Hint:
Only numeric values and dates allowed as described above.
Removing the if-clause doesn't help!
This has to be reviewed!
Possible Workaround: Use the Term-ID!!!
This works! (newest version)
#21
I used the exported view to change to terms weight. I also installed the sql cron module and added just a simple sql string 'update term_data set term_data.weight = (select count(term_node.nid) from term_node where term_node.tid = term_data.tid)' . Its not perfect and should be extended to check, if the counted nodes are of a specific type and if they are visible and so on. Its just a silly workaround, but for my case it was working. Really hope, that this module will be updated soon. I like it and it works great. Just the weight problem should be solved somehow.
#22
I played with this and see the same problem. What I found I need to do was set field of Term ID as the top field in the list. Then the cloud weight drop down shows term id rather than blank. Set weight to term id, tick the hide weight to remove it from the cloud and tick randomise to change the order.
BTW I have have install term node count which allows me to filter on terms with >0 nodes to make a more useful cloud.
#23
I also installed Term node count - but why is it not possible to choose the field of this module as a cloud weight field (although it is numeric I think)? Wouldn't it be more logical to weight the tags by the numbers of nodes using it???
#24
I managed to get the term_node_count module to be the actual provider of the weight, by doing this:- create a "hidden" field for the count of nodes tagged with the term.
- create a "hidden" field for the term ID, set it to rewrite the output, and use the token for the previous field (node count).
- Select the term_id field as the cloud weighting field.
Of course you can add some other fields.
I think it's better to do this workaround than writing code :)
EDIT: sorry, I didn't confirm it properly... and it wasn't working :(
jedihe
#25
Same issue. Views Cloud does not identify an integer type CCK field as numeric. I implemented a workaround for now by simply commenting out the if clause (see attached patch). I'll look into this and see if I can contribute an actual bug fix.
#26
Did a bit more investigating today:
<?phpforeach ($fields as $field => $handler) {
//if (in_array($handler->definition['handler'], array('views_handler_field_numeric', 'views_handler_field_date'))) {
if ($label = $handler->label()) {
$options[$field] = $label;
}
else {
$options[$field] = $handler->ui_name();
}
//}
dpm($handler->definition['handler']);
}
?>
Results:
content_handler_field_multiplecontent_handler_field_multiple
content_handler_field_multiple
content_handler_field_multiple
content_handler_field_multiple
content_handler_field_multiple
These fields are all CCK Number integer fields, and they're not set as multiple. I recommend removing the if clause entirely unless there actually is an error-proof way of checking the field type.
#27
subscribing...
#28
Same problem, subscribing.
#29
as in #23 i also installed the term node count views plug in for term views. it definitely makes sense to me to create clouds based on the amount of nodes tagged with the same tag.
but the Cloud weight field is not taking the Term Node Count field as a parameter.
see also this feature request: http://drupal.org/node/459874
#30
There has been a lot of confusion over how to create an actual Tag cloud (the most common use-case), since you actually don't use the "Cloud" row display style at all. Instead you use a normal "List" or "Unformatted" (or whatever you like) row style, and add an *argument* for Taxonomy: Term. Then you use the summary style "Cloud" for show a tag cloud. This has been documented in the new Readme: http://drupalcode.org/viewvc/drupal/contributions/modules/views_cloud/RE...
Regarding solipsist's comments in #26, we can determine which CCK fields are numeric by retrieving the field definition and checking the data type from there. I've committed this patch which makes all integer, decimal, float, and date fields available as options for cloud weighting.
#31