Closed (works as designed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.0-rc4
Component:
Usability
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Jul 2008 at 18:03 UTC
Updated:
23 Mar 2011 at 15:10 UTC
Comments
Comment #1
yched commentedI'm sorry, you're not being clear. Please rephrase, describing precisely :
- what are the actios you take
- what is the result you expect
- what you get instead
Comment #2
ar-jan commented- On a custom content type, I changed the order of some fields (like Body, Title, Attachment) using the 'Manage Fields' tab of CCK. The default position for Attachment is at the bottom. I have changed the order, putting it above a CCK field.
- So the place where the 'Upload a file' option is when adding content changed (expected), and also when viewing the node, the attachment is no longer at the bottom. This is all expected.
- Now when I change 'Attachment' back to the bottom of the list in 'Manage Fields', it is down there only in that list. When I create a node of the content type, 'Upload a file' is at the top, and when I view the published node, the attachment is at the top.
- This may be because because the other fields are not CCK fields, but Biblio fields. I can only change the position of 'Attachment' relative to CCK fields, but then CCK assigns a weight like -1 for it (I notice this when 'Manage Fields' is loading, you see some weight numbers, which disappear when it's loaded). I would like to give the Attachment field a weight like 40 so it's really on the bottom. Problem is I cannot manually assign a weight.
I hope I made my problem clear this time... Thanks for listening.
Comment #3
ar-jan commentedI came to a solution by total accident. I was playing with the Popup Modal Dialogs (http://drupal.org/project/popups). Turns out that when in a popup, the normal widget for dragging to change the order of fields does not work, instead it displays the weight values!
So I was able to set the weight to the usual 30 again. It was at -1, the value assigned by CCK. My problem is solved now, but may some attention should go to this, for example: dragging a field to the bottom should assign weight 30, not -1.
Comment #4
yched commentedIt is not CCK that assigns the -1, it is the core tabledrag.js script that handles drag-n-drop, and generally generates negative weights
The problem here is indeed that the node contains other non-cck 'fields', whose weight stays untouched (generally >= 0), and thus do not play well with reorderable fields. CCK does provide a hook_content_extra_fields() that other contrib modules can use to have their 'fields' reorderable by CCK's 'Manage fields' tab. So the real solution here is to file a feature request against Biblio.
Comment #5
agentrickardDocumentation for the hook?
Comment #6
agentrickardCorrect?
Comment #7
yched commentedCorrect (except the
= NULLpart in the arguments should not be needed, a valid content type should always be passed to the hook.)content_form_alter takes care of altering the weight of node form elements it finds. This means that if your form elements are added after content_form_alter(), you'll have to set the right weight yourself (you can retrieve it using content_extra_field_weight() ).
I still need to properly document this :-(
Comment #8
agentrickardThe code above seems to work just fine. I'll probably leave the NULL check in just for paranoia.
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #10
Architeck commentedskyredwang has provided this workaround.
"Here is my solution: disable javacript on the manage fields page, then manually type into weights."
Comment #11
mjourney2 commentedHere here. Many thanks GeoffPalin for this amazing tip.
For anyone wondering how to do this... use FireFox, go to Tools->Options->Content and disable javascript. Reload the page. Change the weights, then re-enable it and submit the form. Voila!
Comment #12
geerlingguy commentedSubscribing - you just saved my bacon!
Comment #13
summit commentedSubscribing, but why is this closed. Shouldn't this javascript workaround be solved somehow?
Greetings, Martijn
Comment #14
crossfish commentedAgreed! The "Title" field of the node apparently sets the base for all other weights and you can't edit the weight of that field (grayed out) even with javascript turned off. I'll go searching for where those weights are stored in the database and see if I can get out of the jam I'm in now as the save/preview buttons are floating around based on those other weights.
Comment #15
crossfish commentedFollow-up. Turns out YOU CAN EDIT the weight of a grayed out "node module form" field, so don't let the normal user interface convention of grayed out fool you like it did me. :) The whole issue here is the save/preview buttons get inserted into the $form when the weights hit 0. Might be kinda cool to have a slider (or a buttons-here field) on that manage fields screen which sets the "zero weight base" mark for placing buttons or calculating integer offsets up and down from that base. I know some folks use multiple save buttons on some forms, but for us noobs who don't know where the internals are stored it would sure be easy to get this pesky weight problem solved.