Extending the Facebook Like button sample

Posted by Community Admin on 03-Aug-2018 15:31

Extending the Facebook Like button sample

All Replies

Posted by Community Admin on 01-Mar-2011 00:00

As an exercise, I decided to try altering Ivan's sample into a small module so that it could support localization.  It's worked well so far, but I have two questions:

1.  How do I get a custom icon to appear in the toolbar?  Is the only way to edit the project itself rather than doing something in the module?
2.  It never seems to hit the Install method on the module when it's added through the site administration.  When/how is the Install method triggered?

Source

Posted by Community Admin on 28-Mar-2011 00:00

Hello Michael,

first of all, I'd like to apologize for the late answer.

Here is the answer to your questions:

1.  How do I get a custom icon to appear in the toolbar?  Is the only way to edit the project itself rather than doing something in the module?

Admittedly, we do not have a easy way to do this. I've added this to our backlog to be fixed very soon after Q1 is released. In the mean time, this is how you can do it.

The icons on the widgets are really pulled from CSS. Each widget in the toolbox can have a specific CSS class, like we have it for example for the Blog Posts widget:

var tool = new ToolboxItem(section.Tools)
   Name = "BlogPostsView",
   Title = "BlogPostsViewTitle",
    Description = "BlogPostsViewDescription",
    ModuleName = BlogsModule.ModuleName,
    CssClass = "sfBlogsViewIcn",
    ResourceClassId = classId,
    ControlType = typeof(BlogPostView).AssemblyQualifiedName
;

One you set the CssClass, as we have to "sfBlogsViewIcn", then it's rather simple to style the icon to appear there with CSS. The problem, however, is that we don't have a straightforward way for adding custom style sheets only to page editor control. Therefore, I suggest you create a small style sheet and add it to your page (or even better template) by using the CSS widget. This is going to be a bit of an overhead, as this styles will be loading on the public side as well, but that CSS won't be more than 2-3 lines so it should be fine for the time being.

2. It never seems to hit the Install method on the module when it's added through the site administration.  When/how is the Install method triggered?

Only modules can be installed, therefore classes that inherit from at least ModuleBase base class. In Sitefinity, when we say "module" we mean "small application" - something that has some backend interface, some frontend interface, perhaps data layer and so on.

In order to install a module, you need to:
1. Create a module class (that inherits from ModuleBase)
2. Implement all the needed members (ModuleBase is an abstract clasS)
3. Register the module in Sitefinity, through SystemConfig > ApplicationModules

Hope this helps.

Greetings,
Ivan
the Telerik team

This thread is closed