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

Forums / Sitefinity SDK / Feature request

Feature request

4 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    08 Nov 2010
    Link to this post
    You know the cool new Css\Js widgets?...

    Would you perhaps be able to add in the ability to make those Themeable?  So a CSS rule for example would only render for X theme?
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    08 Nov 2010
    Link to this post
    Hello Steve,

    Thank you for the feature request. We will log it for review by the team. However I am not quite sure that this will be implemented because if you wish to have a style rule render only for a particular theme you can just input it in the theme's rules.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    08 Nov 2010
    Link to this post
    Thanks, it's a local need for us...custom style (inline or external) only loaded for a single page of a certain theme.

    So I guess I can try to override it and add it in myself...
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    09 Nov 2010
    Link to this post
    Hi Steve,

    You can try with an override of the default CssEmbedControl. You will get the current page's theme and if it is not the desired one you will not create the control:
    using System.Web;
    using System.Linq;
    using Telerik.Sitefinity.Web;
    using Telerik.Sitefinity.Web.UI.PublicControls;
    using Telerik.Sitefinity;
     
    namespace Sitefinity.Samples
    {
        class CustomCssEmbedControl : CssEmbedControl
        {
            protected override void CreateChildControls()
            {
                SiteMapNode currentNode = SiteMapBase.GetCurrentProvider().CurrentNode;
                PageSiteNode node = (PageSiteNode)currentNode;
                var pageNode = App.WorkWith().Pages().Where(p => p.UrlName == node.UrlName).Get().FirstOrDefault();
                if (pageNode.Page.Theme == "ThemeName")
                {
                    base.CreateChildControls();
                }
            }
        }
    }

    The above sample code should get you on the track to achieving this.

    Greetings,
    Radoslav Georgiev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
4 posts, 0 answered