Using the new costum placement feature in v.1.5

Topics: Customizing Orchard, Writing themes
Jul 18, 2012 at 11:51 AM

Hi, I am João and I'm starting to work with Orchard (currently at the latest version from the default branch from source control). 


I wanted a specific field (Fields_MediaPicker) from a specific content type to be shown on the Layout Featured zone of my theme. 
I came across this article: http://orchard.codeplex.com/discussions/348649 and I realised that I could do this in my theme's placement.info file: 
<Place Fields_MediaPicker="/Featured:1"/>

Now, my problem is the Fields_MediaPicker replaced the Zone [Featured], instead of being injected inside it. Is this the default behavior?
Because our featured zone has alternates and wrappers.
Is there any way to maintain the featured zone and not replace it?

Jul 18, 2012 at 9:43 PM

I've done a bit more digging on this issue, I believe this is to do with when the shape Featured is created.

With moving the part onto the zone in the placement.info, when the shape Featured is created it is not aware it should be Zone so is setting it's placement shapetype to ContentZone instead of Zone, thus not having the correct behaviour.

I tried to get around this, by forcing the shape type to be Zone in the placement.info like this

<Place Featured="shape=Zone"/>

But it didn't work, I also tried creating a custom shape table provider in the theme to set the behaviour as a zone, but it didn't work also:

public class FeaturedZoneShapeTableProvider : IShapeTableProvider
    {
        public void Discover(ShapeTableBuilder builder)
        {
            builder.Describe("Featured")
                .OnCreating(creating => creating.Behaviors.Add(new ZoneHoldingBehavior(() => creating.New.Zone(), null)));
        }
    }

I may be missing something obvious, I'm still trying to get my head around clay, can anyone aid us on this?

Cheers,

P.

 

Coordinator
Jul 23, 2012 at 1:23 PM

Please file a bug.

Jul 27, 2012 at 3:58 PM

Done, http://orchard.codeplex.com/workitem/18871 let me know if we're on the right track, and I'll be happy to try and sort it out if needed.