Can a widget contain a layout?
Can I drag\drop a widget and have a section of it already contain layouts to drop in other controls??
If not, why not, and when can I get my hands on this? :)
+1
@Kurt FYI, I opened a ticket on this...doesn't look like it's possible
FYI though it SHOULD be possible, can you imagine the possibilities?
@Steve: I think it would be really nice when we have a mechanism like 'layers', as they use in Orchard. That gives much more flexibility.
Maybe a nice addition for 5.2 ;)
Hello guys,
I just wanted to share the information from the ticket (hopefully Steve won't mind). Here's the answer from one of our developers:
I understand that you actually need a widget which can be a container for other widgets in which you can implement your permissions logic. Unfortunately we do not have widgets like this which you can inherit from.
So you can do two things. Inherit the widget that you need to have permissions (widgets that you want to be placed in permissions container). You can create a base control which implements the permissions and replace all tool box controls with new ones that will inherit from the corresponding Sitefinity widget and your new permissions control.
Your other option is to plug into the front end page rendering and apply the permissions. To do so you need to register your own page resolver inherited from SitefinityPageResolver and to override the BuildControls method.
Here is an example:
public
class
CustomPageResolver : SitefinityPageResolver
protected
override
void
BuildControls(PageData pageData, List<IControlsContainer> controlConatiners, CursorCollection placeHolders, DirectiveCollection directives)
base
.BuildControls(pageData, controlConatiners, placeHolders, directives);
//Iterate through the placeholders and modify their output here
protected
void
Application_Start(
object
sender, EventArgs e)
Bootstrapper.Initialized += OnInitialized;
private
static
void
OnInitialized(
object
sender, ExecutedEventArgs args)
if
(!ObjectFactory.Container.IsRegistered<CustomPageResolver>(
"CustomPageResolver"
))
ObjectFactory.Container.RegisterType<IVirtualFileResolver, CustomPageResolver>(
"CustomPageResolver"
,
new
ContainerControlledLifetimeManager(),
new
InjectionConstructor());