| « See you at MIX11 | Orchard Indexing » |
Placement.info hidden features
The placement.info file contains information on how to customize the rendering for shapes in a theme. Recently we made some changes to enhance its functionalities, and it's great. However no one is using them, not because it's useless, but because I never documented them. And to be honest, I had to dive into the code to remember it.
Path
The first thing we added was to be able to alter the Match clause with the current Path. Thus you can disable the rendering or change the location of a specific shape for a set of pages only.
<Match Path="/About" DisplayType="Summary"> <Place Parts_RoutableTitle_Summary="-"/> </Match>
This example would simply hide the summary on the /About page only. You can also use trailing stars to define it for a container, like /myblog/*.
Switching Shape Type
Using the current dev version you can also do crazy stuff, like changing the shape type dynamically. For instance, you are about to render a shape A, but is some cases, it should render B instead. You can do it like this:
<Place Parts_RoutableTitle="Header:5;shape=Foo"/>
This will substitute the Parts_RoutableTitle by the shape Foo. By doing it, you will also clear all alternates and wrappers associated to the current shape. This can be useful when combined with next presented feature.
Adding Alternates and Wrappers
Using the same technique as shown previously, you can add new alternates and wrappers to a shape based on the current Match.
<Place Parts_RoutableTitle="Header:5;alternate=foo;alternate=bar;wrapper=baz"/>
You can repeat alternate and wrapper verbs as you need.
Placement.info is really a simple and powerful way to solve Theming puzzles, and those new features should help even more in this.
Update
Those features are only available as of version 1.1. The official documentation can be found at http://orchardproject.net/docs/Understanding-placement-info.ashx
Trackback address for this post
1 comment
This post has 20 feedbacks awaiting moderation...