ContentTypes -> Field order -> Content Part order

Dec 21, 2010 at 12:52 PM

Is there a way the field and contentparts can ordered?

Developer
Dec 21, 2010 at 7:03 PM

Hi, I guess you mean a display order?

If so, you can order the display of content part shapes in the Placement.info file in the root of your module (eg. Content:1, Contnet:2 and so on). Fields are displayed in the way the type developer wanted to - in the appropriate shape for a given part (of course you can override the shape .cshtml for any given part if you want to display fields in different order).

Cheers, Piotr

Dec 21, 2010 at 7:32 PM

Yup i ment display order. On such a level that the admin can deside it without any knowledge of development. I understand that the fields within a contentpart are displayed in the way the developer wants to, but the fields added in the admin ui by config... they seem to appear in the order they are created.

Developer
Dec 21, 2010 at 7:57 PM

Yes, you are right - fields added through the UI appear in the creation order, and as far as I know there's currently no possibility of changing their order (other than deleting and adding again or making manual changes in the db)...

I agree that there should be some up/down arrows (like in widget zones), or at least textbox (like in menu) to define the order.

Cheers, Piotr

Coordinator
Dec 21, 2010 at 8:11 PM

Actually there is, give me a few minutes.

Coordinator
Dec 21, 2010 at 8:18 PM

I logged a couple bugs related to this scenario, which should be fixed in the 0.9.253 build. I believe the theme system can now reorder fields with specific names (and not just reorder based on the field type name), using Placement.info. I think you want the fix from 3908 (de874ea1c149). I’ll try to cook up an example to see if it works.

Theming provides no control over placement of specific fields of the same field type

http://orchard.codeplex.com/workitem/16915

Theming allows for template overrides for specific field names, but they are not qualified by the content type

http://orchard.codeplex.com/workitem/16916

The fixes are here:

3908 (de874ea1c149) Adding differentiator fallback for field locations override

http://orchard.codeplex.com/SourceControl/changeset/changes/de874ea1c149

3923 (ba2fed9de5ca) Field template alternates based on field name and content part/type name

http://orchard.codeplex.com/SourceControl/changeset/changes/ba2fed9de5ca

Field template alternates based on field name and content part/type name

When a ContentShape is returned from a ContentFieldDriver alternates are added automatically

Patterns include:

ShapeName

ShapeName__FieldName

ShapeName__PartName

ShapeName__FieldName__PartName

For content fields the part name is, essentially, always the same as the content type name

Field drivers must add a ContentPart property to the shape they return, or only the field name will be a valid alternate

Updated TextFieldDriver

Bradley

From: bertrandleroy [email removed]
Sent: Tuesday, December 21, 2010 12:12 PM
To: Bradley Millington
Subject: Re: ContentTypes -> Field order -> Content Part order [orchard:239110]

From: bertrandleroy

Actually there is, give me a few minutes.

Coordinator
Dec 21, 2010 at 8:33 PM

Thanks, I was actually trying it when you wrote that, trying to get the right string into placement.info.

From: bradmi [email removed]
Sent: Tuesday, December 21, 2010 12:19 PM
To: Bertrand Le Roy
Subject: Re: ContentTypes -> Field order -> Content Part order [orchard:239110]

From: bradmi

I logged a couple bugs related to this scenario, which should be fixed in the 0.9.253 build. I believe the theme system can now reorder fields with specific names (and not just reorder based on the field type name), using Placement.info. I think you want the fix from 3908 (de874ea1c149). I’ll try to cook up an example to see if it works.

Theming provides no control over placement of specific fields of the same field type

http://orchard.codeplex.com/workitem/16915

Theming allows for template overrides for specific field names, but they are not qualified by the content type

http://orchard.codeplex.com/workitem/16916

The fixes are here:

3908 (de874ea1c149) Adding differentiator fallback for field locations override

http://orchard.codeplex.com/SourceControl/changeset/changes/de874ea1c149

3923 (ba2fed9de5ca) Field template alternates based on field name and content part/type name

http://orchard.codeplex.com/SourceControl/changeset/changes/ba2fed9de5ca

Field template alternates based on field name and content part/type name

When a ContentShape is returned from a ContentFieldDriver alternates are added automatically

Patterns include:

ShapeName

ShapeName__FieldName

ShapeName__PartName

ShapeName__FieldName__PartName

For content fields the part name is, essentially, always the same as the content type name

Field drivers must add a ContentPart property to the shape they return, or only the field name will be a valid alternate

Updated TextFieldDriver

Bradley

From: bertrandleroy [email removed]
Sent: Tuesday, December 21, 2010 12:12 PM
To: Bradley Millington
Subject: Re: ContentTypes -> Field order -> Content Part order [orchard:239110]

From: bertrandleroy

Actually there is, give me a few minutes.

Coordinator
Dec 21, 2010 at 8:37 PM

Well, the bad news is that this checkin was made without tests and… it doesn’t work. It’s horribly broken.

From: bradmi [email removed]
Sent: Tuesday, December 21, 2010 12:19 PM
To: Bertrand Le Roy
Subject: Re: ContentTypes -> Field order -> Content Part order [orchard:239110]

From: bradmi

I logged a couple bugs related to this scenario, which should be fixed in the 0.9.253 build. I believe the theme system can now reorder fields with specific names (and not just reorder based on the field type name), using Placement.info. I think you want the fix from 3908 (de874ea1c149). I’ll try to cook up an example to see if it works.

Theming provides no control over placement of specific fields of the same field type

http://orchard.codeplex.com/workitem/16915

Theming allows for template overrides for specific field names, but they are not qualified by the content type

http://orchard.codeplex.com/workitem/16916

The fixes are here:

3908 (de874ea1c149) Adding differentiator fallback for field locations override

http://orchard.codeplex.com/SourceControl/changeset/changes/de874ea1c149

3923 (ba2fed9de5ca) Field template alternates based on field name and content part/type name

http://orchard.codeplex.com/SourceControl/changeset/changes/ba2fed9de5ca

Field template alternates based on field name and content part/type name

When a ContentShape is returned from a ContentFieldDriver alternates are added automatically

Patterns include:

ShapeName

ShapeName__FieldName

ShapeName__PartName

ShapeName__FieldName__PartName

For content fields the part name is, essentially, always the same as the content type name

Field drivers must add a ContentPart property to the shape they return, or only the field name will be a valid alternate

Updated TextFieldDriver

Bradley

From: bertrandleroy [email removed]
Sent: Tuesday, December 21, 2010 12:12 PM
To: Bradley Millington
Subject: Re: ContentTypes -> Field order -> Content Part order [orchard:239110]

From: bertrandleroy

Actually there is, give me a few minutes.

Coordinator
Dec 21, 2010 at 8:44 PM
Edited Dec 22, 2010 at 12:16 AM

You can still modify this from a placement.info file that you put into the root folder of your current theme. Ideally there would be an admin-based story for that (see http://orchard.codeplex.com/workitem/16926) but for the moment it must be done with placement.info.

Here is an example that would force the Name field to appear before the DateOfBirth field if the feature actually worked:

<Placement>
  <Place Fields_Common_Text-Name="Content:1"/>
  <Place Fields_Common_Text-DateOfBirth="Content:2"/>
</Placement> 
Dec 21, 2010 at 11:36 PM

hmm.. instead of a Placement.info could a migration be used to insert placement into the database.
A aditional placementprovider or whatever it might be called.
That way the admin ui can be altered in the future to alter placement in runtime. 

PS: I can do enough with the placement file ;)

Coordinator
Dec 21, 2010 at 11:46 PM

A migration does not seem to be an improvement for something that gets created from the admin UI... The goal eventually is to have admin UI to modify placement though.

Coordinator
Dec 22, 2010 at 12:01 AM

Just got this snippet from Renaud (who implemented ordering of specific fields in Placement.info)…

If you have a “text” field named “Location”, you can override it’s position like this:

<Place Fields_Common_Text-Location="Content:2.5"/>

From: bertrandleroy [email removed]
Sent: Tuesday, December 21, 2010 3:47 PM
To: Bradley Millington
Subject: Re: ContentTypes -> Field order -> Content Part order [orchard:239110]

From: bertrandleroy

A migration does not seem to be an improvement for something that gets created from the admin UI... The goal eventually is to have admin UI to modify placement though.

Feb 8, 2011 at 11:25 AM

Could somone please confirm if this is working or not...

I have the following in a custom theme

    <Match DisplayType="Summary">
        <Place Fields_Contrib_TaxonomyField="Content:after"/>
        <Place Fields_Contrib_TaxonomyField-AgeGroups="Content:1"/>
    </Match>

I can confirm I have the placement working for all field positions

<Place Fields_Contrib_TaxonomyField="Content:after"/>

But I can not get the specific field position to work...

<Place Fields_Contrib_TaxonomyField-AgeGroups="Content:1"/>

Coordinator
Feb 8, 2011 at 7:15 PM
Edited Feb 8, 2011 at 7:16 PM

I've seen things like that happen and I think it's a regression: when there is already something at this position, it seems that both don't appear. Can you try with a different ordering number, or maybe even Content:1.1?

Oh and it that's confirmed, can you please file a bug?

Feb 9, 2011 at 10:54 AM

Issue raised: http://orchard.codeplex.com/workitem/17320

Feb 21, 2011 at 10:08 AM

I cant seem to get this working either. Is there a workaround?

Coordinator
Feb 21, 2011 at 10:42 PM

A workaround that has worked for me is to use dot notation to build a position that doesn't conflict (see message above).

Feb 22, 2011 at 6:06 PM

I was unable to get this to work with the dot notation. Let me know if this works for you...

Assuming that I have the syntax correct for referencing in the placment.info file i.e.

Fields_Contrib_TaxonomyField-AgeGroups ==> {shape}-{field name}

I have tested this with and without a corresponding "Contrib.TaxonomyField-AgeGroups.cshtml" file in the theme leading me to think that neither placement or specific field rendering is working as it does not seem to pickup the "Contrib.TaxonomyField-AgeGroups.cshtml" file.

Anyone else able to test or confirm? I assume my syntax is correct?



Coordinator
Feb 22, 2011 at 6:24 PM

This specific one might be an issue from the taxonomy module, I will check this.

Coordinator
Feb 22, 2011 at 7:15 PM

Ah, yes, I think that's this bug: http://orchard.codeplex.com/workitem/17320. Vote it up!