The ILikeableContentType plugin type provides support for liking content.
Why should I make my content likable?
If you would like users to provide feedback by demonstrating that they like your content then consider implementing the ILikeableContentType within your IContentType plugin.
Creating an ILikeableContentType plugin
The ILikeableContentType Plugin Type is defined in the Telligent.Evolution.Extensibility.Content.Version1 namespace. For the following example, we'll add the ILikeableContentType to the existing content type plugin defined in the Content Type Example , updating the LinkItemContentType definition to:
public class LinkItemContentType : IContentType, ITranslatablePlugin, ILikeableContentType
The ILikeableContentType interface defines three members: SupportsLikes, CanLike() and CanUnlike() to identify support for liking and who can like and remove likes. For a simple implementation, all can return true. The implementation could be customized to check permissions to only allow specific users access to like based on their relationship to the content.
#region ILikeableContentType
public bool SupportsLikes { get; } = true;
public bool CanLike(Guid contentId, int userId)
{
return true;
}
public bool CanUnlike(Guid contentId, int userId)
{
return true;
}
#endregion
Once the project is rebuilt and the plugin is , liking link items can be performed using the core_v2_ui Script API 's Like method or the Like API.