This project is read-only.

Edit Shapes from within Dashboard

Topics: Core, Customizing Orchard, Writing modules, Writing themes
Dec 19, 2013 at 2:24 PM
In the "TheThemeMachine" theme that ships with Orchard, the Layout.cshtml embeds a Shape something similar to:
WorkContext.Layout.Header.Add(New.Branding(), "5"); // Site name and link to the home page
If I go to "Widgets" on the Dashboard, I see the "Header" zone empty with no Widgets added.

Is there a way to edit the content of the "Branding" shape from within Dashboard in Orchard?

The reason I am asking is that. Assume, I am embedding some HTML using a Shape/Shape Template. Later on the Admin of the website wants to edit this content. How to go about that?

Please note that I could use HTML Widget for that, but in some cases, the HTML rendered contains code blocks to fetch data from Database.

Dec 19, 2013 at 6:35 PM
There is a module named Theme Editor:

that provides you with a tab to edit the View files that are directly under the Views folder (no subfolders), which will be where the Branding.cshtml shape is.

It also allows you to modify CSS files and system files like Placement...directly from the Admin. Highly recommended module...I use it on every site I do.
Dec 19, 2013 at 8:35 PM
Thanks a lot. I will install and try it.

Dec 19, 2013 at 8:45 PM
Theme Editor looks good from a developer/Admin perspective, not a normal user on the CMS.

Dec 19, 2013 at 11:29 PM
The Branding shape itself should be pretty straight forward HTML, but you are's not a friendly WYSIWYG editor like creating a normal Content Item.

Perhaps adding some comment tags around where you want them to modify the content would make it easier for non-developers:
<!-- START OF TEXT -->
this is the text you should modify
<!-- END OF TEXT -->
That way you wouldn't have to develop any code and could use this module. If that doesn't work, I'm sure you could build something more custom...Orchard is very extensible.
Dec 20, 2013 at 7:26 AM
What are my other options? Develop a new module per website, include all Widgets that I want to render on the website, that way the content user would be able to add/remove content (using widgets) from the Widgets page on Dashboard? Any other suggestion?

Dec 25, 2013 at 6:00 PM
The upcoming version 1.8 will enable you to edit shapes from the dashboard. The shapes are stored as Razor markup in the database, and CodeMirror is used as the code editor. Sébastien demoed this on the last meeting.