In my content type I have block, code and preprocess fields along with normal fields displayed in Fluid two column stacked template.
When I edit the fields in manage display tab and sort them the order of fields is stored fine. However when I view the content the order of fields is not the same as set in manage display tab. One of fields is displayed two fields "higher" than it should be. When I rearrange the fields a little then other field is displayed higher than it sould be. This is happening only in the middle of one region.
I've recently updated Drupal to 7.22 and Display Suite version is 7.x-2.4. Could you help me and suggest what can I try to debug in preprocess function or somewhere else to check what's changing my fields order?
Comment | File | Size | Author |
---|---|---|---|
#17 | ds-display_order_weight_of-2035531-17.patch | 870 bytes | heddn |
Comments
Comment #1
philipz CreditAttribution: philipz commentedOK, I've switched to show fields' weights and entered weights for fields around the place where problem occured like that: 1,2,3,4,15,16,17.
Now the fields display as they should.
The weights before I changed them manually were: 8,9,10,11,12,13,14 so that should not have been the problem.
Comment #2
oeroek CreditAttribution: oeroek commentedI have the same problem. I use Drupal 7.22 and DS 7.x-2.4. I added preprocess fields using the technique in http://www.lullabot.com/blog/display-suite-building-fancy-teasers-withou...
I also use Fieldgroup 7.x-1.1 to make some horizontal tabs and div groups. The horizontal tabs are fine. The preprocessed fields above the tabs are looking fine when working in the admin view "manage displays". When I open the page itself, some preprocessed fields that drop from above the horizontal tabs group to the bottom.
Solution in comment # worked for me. Not sure if the problem is in Fieldgroup or in DS. it seems however that the drag and drop numbering of preprocessed fields is not correct.
Edit: when working further on this I noticed that the problems seem to concentrate to preprocess fields in combination with fieldgroup to make horizontal tabs. I changed the preprocess blocks into code fields and that also solves the problem for me.
Comment #3
Diane Bryan CreditAttribution: Diane Bryan commentedSame problem today with Drupal 7.23 and Display Suite 7.x-2.5, sorry to say. I was able to trick DS into eventually putting things where I want them by continuing to rearrange them until they were right.
Comment #4
SchnWalter CreditAttribution: SchnWalter commentedWhen attaching the preprocess field to the $variables['content'] array an weight should be specified, this is the root of the problem.
The attached diff file contains the minimum required changes to v7.x-2.6 in order to fix this issue. And the patch contains an attempt to clarify the code.
Comment #5
aspilicious CreditAttribution: aspilicious commentedIt sounds weird to have $weight as a value. Is it possible to swap these around?
Can you explain why the merge is necesary?
This changes formatter_settings to formatter. Is this a bug or why are you doing this?
Note to self, I have to verify if this is actually the same
Comment #6
SchnWalter CreditAttribution: SchnWalter commented1. Agree, it sounds wierd.
2. The $field variable used to contain only the field base settings: "$field = $fields[$key];" and we need the field weight in there which is in the instance_settings. Maybe we can have the 'instance_settings' inside
the $field array instead of having them merged.
3. It was already in there, not sure where it comes from. I would remove it, but i'm not sure if it's still used somewhere.
4. They are the same if we merge the arrays from 2.
Comment #7
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedNoting that I encountered this problem, and this patch fixed it for me. I'm not a helpful case study though because I have fieldgroups, field collections, and custom (DS) fields... so any one of those complications could be the culprit.
In any case, it looks like it's working with the patch.
Comment #8
bleen CreditAttribution: bleen commentedFWIW I'm having a similar problem, but the patch in #4 did not help
Comment #9
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedafter a few more months, it was a false positive. We've had to re-do field order a few times since then. :|
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedI've run into this just now, in a simple case. I created a display for book pages. The book navigation (pseudo-)field and links (pseudo-)field ended up in random order. Repeated manual bashing of the row weights non-deterministically changed the ordering. There were no non-built-in fields involved, or other modules that seem likely to have interfered.
So: It's definitely broken.
I haven't tried the patch, based on the negative reports here.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedChanging status based on failure reports above, and the concerns of aspilicious.
Comment #12
monaw CreditAttribution: monaw commentedI just updated to DS 2.7 and the problem is still there for me ):
Comment #13
haunted CreditAttribution: haunted commentedI have the same problem but for a code field.
I'm using ds 7.x-2.7
Comment #14
loopduplicateNot sure if this will help anyone but figured I'd share. I did this to update the ordering for a site I'm working on:
Comment #15
loopduplicateI should mention that in my case, the field that was rendering out of order was a preprocess field. The preprocess field kept appearing after a block reference field (from the Block Reference module.)
Comment #16
Erik Seifert CreditAttribution: Erik Seifert commented#14 Thanks help for a workaround.
Comment #17
heddnThis fixes it for me. Credit goes to @loopduplicate for the suggestion in #14. I'm pretty sure this should be tested by more than just me. But it definitely works for pre-render field types.
Comment #18
heddnComment #19
pandaski CreditAttribution: pandaski commented#17 is a solution working for me
I am using 7.x-2.10, and this fixes block field out of order issue as well
Comment #20
Plazik CreditAttribution: Plazik commentedPath from #17 works for me too.
Comment #21
sonictruth CreditAttribution: sonictruth at Kalamuna commentedPatch from #17 works for me
Comment #22
aspilicious CreditAttribution: aspilicious at Nascom commentedThis is such a patch that looks harmless but could explode in my face once I create a new release.
I would like to have some more testing before I commit this.
Assigning to Brecht for additional testing.
Comment #23
aspilicious CreditAttribution: aspilicious at Nascom commentedCan someone share a scenario were the order is incorrect?
Comment #24
StG CreditAttribution: StG commented#17 worked for me, thanks.
Here's my scenario:
I created 4 preprocess fields and moved them to the top of the display. Below them there are several field collections. 3 preprocess fields are shown in the right place but the last one was moved down, between two field collections.
Comment #25
aspilicious CreditAttribution: aspilicious at Nascom commentedI don't like preprocess fields...
Luckily this is different for D8.
Committed this. will tag a new release next week if the dev version works for everyone.