The following tutorial demonstrates how to add a Site selector in your widget's designer. You use the Site selector to select different sites defined in your Sitefinity CMS application.
DesignerView.YourView.json
JSON
DesignerView.<YourView>.json
scripts
For more information on the scripts that you must load, see List of selectors scripts reference.
designerview-<yourview>.js
.js
In the code above, you use the propertyService to load the properties of your widget. Next, you create a scope property to hold the Site value. You can watch for any changes in the scope to update the widget properties. For more information about getting and setting the selected item, see Use content items selectors.
propertyService
Site
In your DesignerView.<YourView>.cshtml file, place the following tag where you want to render the Site selector:
DesignerView.<YourView>.cshtml
NOTE: If you do not supply a value for the sfSite attribute, the Site selector selects the default Sitefinity CMS backend site. In addition, if Sitefinity is in single site mode the Site selector is not rendered.
sfSite
To access the selected site, you use the sf-site attribute. You must add the following property in your widget's controller:
sf-site
The value of the sf-site attribute is the sfSite scope property, which has the following JSON structure:
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important