Extend Generic Content Widget

Posted by Community Admin on 05-Aug-2018 17:55

Extend Generic Content Widget

All Replies

Posted by Community Admin on 23-Aug-2012 00:00

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?

Posted by Community Admin on 17-Sep-2012 00:00

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.

Posted by Community Admin on 17-Sep-2012 00:00

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?

Posted by Community Admin on 18-Sep-2012 00:00

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!

Posted by Community Admin on 18-Sep-2012 00:00

Great, I will check it out. Thanks for the help.

Posted by Community Admin on 18-Jul-2013 00:00

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

This thread is closed