Widget Content Placement using Placement.info

Topics: Customizing Orchard
Feb 17, 2012 at 11:41 PM

Thanks in advance for your help.

I have a widget that I have placed in the "Content" area and I want it to be first in the "Content" area.  However, I cannot find a way to get it to come before other stuff that is in the "Content" area.  Here is my Placement.info that I am attempting to use:

<Placement>
  <Place Parts_RoutableTitle="Content:1"/>
  <Place Parts_ImageRotator_Details="Content:2"/>
  <Place Parts_ImageGallery="Content:3"/>
  <Place Parts_Taxonomies_TermContentItems_List="Content:4"/>
</Placement>

In this example, Parts_RoutableTitle, Parts_ImageGallery, Parts_Taxonomies_TermContentItems_List are all from other modules.  Parts_ImageRotator_Details is from the widget.  I am concerned that the widgets, no matter what is used in Placement.Info will always be after shapes generated by modules in the same zone... I am sure someone will say to put it into the "Before Content" zone but that will make a bigger mess of things and cause me to re-order a number of items.  Thanks for letting me know if you can confirm:

  • Module rendered shapes will always appear before widget rendered shapes in the same zone
    • I think this may be the case because when I look at shape tracing, Widgets are rendered with shape "Widget" where "module content" is rendered with shape "Content"
  • OR I am doing something wrong and there is a way to place the widget shape in between (or before) other shapes in the same zone no matter whether they are generated by modules or widgets

Thanks for your help.

Coordinator
Feb 17, 2012 at 11:57 PM

Use a different zone that is before the content zone.

Feb 18, 2012 at 12:20 AM

Thanks Bertrand, that confirms my suspision and I will have to inject another zone.

Feb 18, 2012 at 7:13 AM

Currently, Placement only affects stuff that you emit from Drivers. Widgets are injected via a different mechanism, using a Filter - which is why placement doesn't affect them.

The zone sorting code has a comment to the effect of "this is temporary and will be replaced at some point in the future". Actually since I've been looking at the whole zone/driver/clay code quite a bit, I think I have an idea about how to sort this all out and make placement work more globally, after 1.4 is out I might work on a patch for this.