- Published on
Sitefinity 7.1s new multi-widget module system
- Authors
- Name
- Steve McNiven
- @stevemcniven
Before Sitefinity 7.1 came around, when you had a heirarchical module, it generated a single complex content widget\designer. Understanding how it worked was often confusing and frustrating.
This is all fixed in 7.1…now get an entire toolbox section created and a single widget for each content “Type”. BOO-YA.
Alan Rotem recorded a video showing how it all works, super slick.
The problem is that modules created prior to 7.1 only gave you that single widget, and there’s no way to automatically generate these new widgets so you can update your pages. If you add a new type to your Module, they show up under Content, but you don’t get the dedicated toolbox section and the legacy types don’t get their special widgets.
The good news is that it’s quite simple to do :) Well…bit annoying in that you’re hunting down Guids, but not the end of the world.
So lets take the following test module structure
This is the xml added to your ToolboxesConfig.config
As a reference, this is what the pre 7.1 xml looked like…usually just chucked at the bottom of your “Content” section (bloating it)
It’s essentially saying load X widget of type Y (which you can get from the code samples). The last three properties define the default Master (List) and Detail (Full) templates, and the Type.
Soooo…where do we get the Guids for the templates. Well lets wander over to the widget\control template screen (/Sitefinity/Design/ControlTemplates/ControlTemplates) and open up our friend mr.firebug (to the Console tab).
The console tab will show you all ajax requests sent by the page you’re on and you can then drill into the JSON to find the Ids. I recommend loading the page then performing a search for the templates you want unless you want to endlessly open the JSON objects looking for the right template id.
You can do all this from the backend advanced settings toolbox area, but for a complex module, that’s a lot of clicking and loading. I prefer just to wrap it all together into notepad++ then paste it into the Toolbox config manually (remembering to recycle the app pool). For those who don’t know, adding to the config with the UI means you don’t need to recycle the app pool.
**NOTE: 7.1 Modules are not “special”, it just now generate multiple widgets where before it was a single widget…no harm in migrating to this.