I create field-collection field to node. Then i go to structure - field collections. I click to "Manage fields".
I add field1, field2, field3. Ok, it works.
Now i change order of fields to: field1, field3, field2.
Now i go to node add/edit form and i see it as: field1, field2, field3.
Only chance to re-order them is to delete all and add them. I think it is only about one "order by" statement when building form...

CommentFileSizeAuthor
#6 standalone-form-field-order.patch1.05 KBnkschaefer

Comments

sachbearbeiter’s picture

sub

tim.plunkett’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not having this problem at all. When was the last time you downloaded the dev, perhaps it was fixed more recently?

ronino’s picture

I cannot confirm this, running 7.x-1.0-beta2. Works as expected, field order is correctly changed.

robcarr’s picture

Status: Postponed (maintainer needs more info) » Active

I'm having this problem regarding field order being observed. I'm running latest 7.x-1.x-dev (24 Nov 11).

However, field order is correct when using the embedded form (from the parent node>edit). I'm only seeing the problem when I 'Add' a field collection item from the Node>View page, ie, the fields [within the collection] are displayed in the original order they were added to the field collection type.

So, using @karlos007's example:

  • On the parent Node > Edit, the collection fields are displayed correctly on an embedded form: field1, field3, field2
  • On the parent Node > View, the collection fields are displayed when 'Add'ing a collection item: field1, field2, field3
charlie-s’s picture

Same issue here. The embedded form respects order. The standalone form does not.

nkschaefer’s picture

Project: Field collection » Field Collection Table
Status: Active » Needs review
StatusFileSize
new1.05 KB

The problem is with using the Field Collection Table module. That module sets the standalone Field Collection edit form to use one of its theme hooks. This theme hook is what makes all the fields appear in a nice table when using the embedded widget and editing the parent content that contains the field.

When using the standalone Field Collection form, though, no check is made to ensure that fields are rendered in the correct order - I've attached a patch that does that. All it does is look at the weight of each field widget after calling field_info_instances() and before adding them to the form.

Thanks,
Nathan

tim.plunkett’s picture

Status: Needs review » Fixed

@nkschaefer, thanks so much for nailing that down!

I cleaned it up a little bit to be more in line with _field_sort_items_value_helper()

http://drupalcode.org/project/field_collection_table.git/commit/c3054c8

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.