More in this section

Forums / General Discussions / Extending the Facebook Like button sample

Extending the Facebook Like button sample

2 posts, 0 answered
  1. Michael
    Michael avatar
    7 posts
    Registered:
    07 Dec 2010
    01 Mar 2011
    Link to this post
    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
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    28 Mar 2011
    Link to this post
    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
2 posts, 0 answered