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

Forums / Designing & Styling / Extend Generic Content Widget

Extend Generic Content Widget

6 posts, 0 answered
  1. Raymond Dowe
    Raymond Dowe avatar
    37 posts
    Registered:
    10 Mar 2010
    23 Aug 2012
    Link to this post
    Excuse me if this has been asked elsewhere, but I'm having problems finding an answer. Is there an easy way to extend/copy+modify the generic content widget?

    Consider the following scenario. I have a website that a client will be editing themselves. There are a number of content pages that have pull quotes with a different sized font and a background colour. I would like for them to be able to add a generic content widget and add content, and then underneath add a custom "Pull Quote" widget and enter content in the same way.

    I've accomplished this before by editing the properties of a normal generic content widget and adding a CssClass, but I find this is beyond the abilities of our average client. I've also accomplished what I'm describing in older versions of Sitefinity using the example shown  here, but that seems to have stopped working a while ago.

    Is there a simple equivalent for that example in the latest version of Sitefinity?
  2. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    17 Sep 2012
    Link to this post
    Raymond Dowe,

    Creating a custom widget would do it but if letting the client set a css class will work then I'd suggest doing that.
    In Administration -> Settings -> Text Editor, click "Edit" on the default tool set...then add
    <tool name="ApplyClass" />
     to the tools and...
    <classes>
      <class name="Clear Class" value="" />
      <class name="Blue Quote" value=".quote1" />
      <class name="Red Quote" value=".quote2" />
    </classes>
    <cssFiles>
      <item name="~/Sitefinity/WebsiteTemplates/Custom/App_Themes/Custom/Global/radStyles.css" />
    </cssFiles>
     right before </root>.

    Naturally, you can edit the classes and names to match your needs but that should get you started. Keep in mind that the classes in the "value=" must exactly match the class in radStyles.css.

    Almost forgot, after you save the changes, restart the site. If you don't, the changes may not show up.

  3. Raymond Dowe
    Raymond Dowe avatar
    37 posts
    Registered:
    10 Mar 2010
    17 Sep 2012
    Link to this post
    Hi Tim,

    Thanks for the response. I actually discovered the ApplyClass method a week or two ago, and I've already found it immensely helpful.

    For the pull quote example I gave, it's definitely the easier solution. However, there are more complex situations where applying a single class (or a large number of classes) isn't realistic.

    Do you know of any tutorials that would help me down the "Creating a custom widget" route?
  4. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    18 Sep 2012
    Link to this post
    Raymond,

    Easiest way to get a widget off the ground, nowadays, is to use the Thunder extension for VS. You can install it from the Extension Manager.

    If you have any other questions, feel free to ask!
  5. Raymond Dowe
    Raymond Dowe avatar
    37 posts
    Registered:
    10 Mar 2010
    18 Sep 2012
    Link to this post
    Great, I will check it out. Thanks for the help.
  6. Ricardo
    Ricardo avatar
    29 posts
    Registered:
    06 Nov 2012
    18 Jul 2013
    Link to this post
    Hi Raymond,

    Quite interested in understanding how this can be achieved. I also want to extend it so was wondering if you could post your findings.

    Many thanks,

    Ricardo
6 posts, 0 answered