Strip widget wrappers based on certain conditions

Topics: Customizing Orchard, General, Installing Orchard, Troubleshooting, Writing modules, Writing themes
Developer
Mar 29, 2011 at 12:27 PM
Edited Mar 29, 2011 at 12:27 PM

Hi,

What would be the best way to get rid of/modify widget wrappers under certain conditions eg. for specific widget type. Wrapping in <article> is not always the best option.  I see a couple of ways, but I'm not sure which one would be the best in terms of best-practice:

  1. Modify the "Widget_Wrapper" shape - add an alternate (eg. Widget_Wrapper__<content_type_name>)
  2. Modify the "Widget" shape - remove wrapper from the ShapeMetadata.Wrappers collection in OnDisplaying event when conditions are met
  3. Some other ways?

I'd rather go with the 1. approach, but maybe there are better solutions?

Thanks in advance! Piotr

 

Coordinator
Mar 29, 2011 at 10:40 PM

1. not possible: wrappers are not shapes.

2. yeah, worth trying.

Developer
Mar 29, 2011 at 11:54 PM

I'll vote for making wrappers ordinary shapes in 1.2:) Did it differently - overrode the Widget.Wrapper.cshtml shape file and placed a switch statement inside. Not the best option though, but simple and without much mess.

Coordinator
Mar 30, 2011 at 12:25 AM

Please feel free to file a suggestion.