API Questions on Kentico API.
Version 6.x > API > Is there any WebPartSiteInfoProvider ? View modes: 
User avatar
Member
Member
Aon_Vlado - 8/6/2012 5:12:51 PM
   
Is there any WebPartSiteInfoProvider ?
I am trying to make sure that all my custom WebParts are assigned to all sites. Unfortunately I cannot find any example similar to the one for Web part containers in here.
The Managing Web Part section in here does not assign the newly created part to any site and I do not see a WebPartSiteInfoProvider to be available.
Where to start?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/7/2012 12:35:24 AM
   
RE:Is there any WebPartSiteInfoProvider ?
Hi,

Web parts are global objects and they are not assigned to a site - as you can see in the UI, there is no "Sites" tab to assign a web part to given site. So, the web part is available for all sites by default.

Best regards,
Juraj Ondrus

User avatar
Member
Member
Aon_Vlado - 8/8/2012 9:58:50 AM
   
RE:Is there any WebPartSiteInfoProvider ?
Sorry Juraj, you are right.

I did not mean Web Parts but Page Templates. Not sure why I messed up…. Too much piva :-)

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/9/2012 2:58:41 AM
   
RE:Is there any WebPartSiteInfoProvider ?
Hi,

:-)

In the API examples is a sample code how to do it:

// Get the page template
PageTemplateInfo template = PageTemplateInfoProvider.GetPageTemplateInfo("MyNewTemplate");
if (template != null)
{
int templateId = template.PageTemplateId;
int siteId = CMSContext.CurrentSiteID;

// Save the binding
PageTemplateSiteInfoProvider.AddPageTemplateToSite(templateId, siteId);

I hope it will help.

Best regards,
Juraj Ondrus

User avatar
Member
Member
Aon_Vlado - 8/11/2012 7:00:13 PM
   
RE:Is there any WebPartSiteInfoProvider ?
Oh Man, Juro!! This is great! I have never clicked on the support link and have been working with Kentico for 18 months 10 hours a day. Who would, right? I love it, thank you very much.