Is it possible to adjust the placement of a text field by name?

Topics: Customizing Orchard, Writing themes
Mar 22, 2011 at 7:31 PM

I'd like to be able to do something like: <Place Fields_Common_Text:Field_Name="Content:1.1"/> in the placement.info file.

I followed the code for a way but the differentiator (aka field name) seems to be dropped in BuildShapeContext.cs: FindPlacement = (partType, differentiator, defaultLocation) => new PlacementInfo {Location = defaultLocation, Source = String.Empty};

Is there a way to do this currently?

Coordinator
Mar 22, 2011 at 7:35 PM

At least in 1.1, this works: <Place Fields_Common_Text__MyField="Content:1.1" Fields_Common_Text_Edit__MyField="Content:1.1"/>

Mar 28, 2011 at 8:58 PM

Using the first integration cycle/iteration I created a text-field named "EAN" for content type "Printer".

Creating a new shape script works: /Views/Fields/Common.Text-EAN.cshtml or even .../Common.Text-Printer-EAN.cshtml

But doing a placement for "Fields_Common_Text__EAN" or "Fields_Common_Text__Printer__EAN" changes the placement of every single Text field no matter what name it has. Already fixed for 1.1? According to the docs this should have worked using 1.0.

Coordinator
Mar 28, 2011 at 9:05 PM

If that still doesn't work, please file a bug. I'm pretty sure I verified that but I may have missed something.

Mar 28, 2011 at 9:19 PM

I'm unable to say how outdated my version is. According to http://orchard.codeplex.com/discussions/248208 the integration branch should contain the "stable" results of an successful iteration -- but http://orchard.codeplex.com/SourceControl/list/changesets?branch=integration looks like it just contains daily ongoing work.

When setting a breakpoint inside the shape script the shape/model named "Fields_Common_Text" contains 4 alternates:

  • Fields_Common_Text__EAN
  • Fields_Common_Text__Printer
  • Fields_Common_Text__Printer__EAN
  • Fields_Common_Text__Printer__EAN

sic! (the 3 and 4 the same)

(and I really would like to know whats wrong with the Orchard.sln/projects that I always have to expand 5 levels of debugger tooltips for lists and infinite levels of expansion (without success) for dictionaries -- doesn't happen with other WPF oder MVC3 projects -- and yes, I'm on VS2010SP1 which promised to fix this)

Coordinator
Mar 28, 2011 at 9:30 PM

About branches: when you merge branches, you get to see not only the merge change, you also see all the changes from the branch that was merged. We do not work off Integration, ever, but you can see all the changes that were made in different branches that were integrated.

Mar 28, 2011 at 9:34 PM

I can confirm this problem in latest dev.

Coordinator
Mar 28, 2011 at 9:38 PM

Please file a bug then. Thanks.

Mar 28, 2011 at 9:39 PM

"Fields_Common_Text-EAN" works -- but neither "Fields_Common_Text-Printer" nor "Fields_Common_Text-Printer-EAN".

"-" in placement.info? I thought the rules say every "-" in filenames becomes a "__" in shape names?

Coordinator
Mar 28, 2011 at 9:41 PM

In placement, it should be all single or double underscores. e.g. Fields_Common_Text__EAN

Mar 28, 2011 at 9:44 PM

So since it only works using a dash/hyphen it's a bug? Or a special-design feature?

Coordinator
Mar 28, 2011 at 9:44 PM

This is http://orchard.codeplex.com/workitem/17320

Mar 28, 2011 at 9:49 PM

I noticed this ticket and that's the only reason why I tried the hyphen at all -- but doesn't the ticket say hyphens don't work (which do work now)? *puzzled*

Mar 28, 2011 at 10:00 PM

I've tested and hyphens are working (they shouldn't be).

Also, the rules are getting matched in the wrong order, i.e. first rule takes precedence - which is what I think is happening in that ticket.

Apr 27, 2011 at 6:43 PM

Is the bug still existed?

I have the same problem here:

Fields_Contrib_Html__Service__RelatedProjects="Content:2"
Fields_Contrib_Html__Service__RelatedMarketsServices="AsideFirst:3"


I have tried single, double underscore and hyphen and all do not work.