+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Can a widget contain a layout?

Can a widget contain a layout?

5 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    12 Jun 2012
    Link to this post
    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? :)
  2. Kurt
    Kurt avatar
    11 posts
    Registered:
    25 Oct 2010
    14 Jun 2012
    Link to this post
    +1
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    14 Jun 2012
    Link to this post
    @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?
  4. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    15 Jun 2012
    Link to this post
    @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 ;)
  5. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    14 Apr 2013
    Link to this post
    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
            }
        }
    The new page resolver should be registered in the Object Factory. This should be done after the Sitefinity Bootstrapper initialization. On application start, you need to subscribe for the "Initilized" event using the following code:
    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());
               }
           }
    In Advanced settings define the resolver to be used in your application: Advanced Settings > VirtualPathSettings > Virtual Paths > Create New {VirtualPath = "~/SFPageService/*", ResourceLocation = "", ResolverName ="CustomPageResolver" }.

    Regards,
    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    The new page resolver should be registered in the Object Factory. This should be done after the Sitefinity Bootstrapper initialization. On application start, you need to subscribe for the "Initilized" event using the following code:
    The new page resolver should be registered in the Object Factory. This should be done after the Sitefinity Bootstrapper initialization. On application start, you need to subscribe for the "Initilized" event using the following code:
    The new page resolver should be registered in the Object Factory. This should be done after the Sitefinity Bootstrapper initialization. On application start, you need to subscribe for the "Initilized" event using the following code:
5 posts, 0 answered