In the previous post, I’ve shown how to build a simple layout element that was using the Forms API to build its editor. In this post, I’ll show a second element that doesn’t use the Forms API, but builds a custom editor instead.
Orchard layouts are great, and they’re extensible. In this series of posts, I’ll show how to write your own layout elements. Custom elements are a great way to encapsulate and re-use common bits of layout. Instead of having to build everything from grids, rows, cells, text and media, you can build your layouts from higher-level semantic constructs that make sense for your particular site. In this first post, we’ll build a very simple element: an “subscription” section that is made of a title, two lines of information, a monthly price, and a yearly price.
One of the neat features in the new C# 6 is string interpolation, which is a concise way to inject values into a format string, using curly-brace-enclosed expressions. Here’s a simple example of what it looks like: