Expose a property "SelectedLanguages" in the Products web API

Nik De Clercq 5 years ago in Products updated by anonymous 4 years ago 0

In Products web, you can find the selected languages when creating a custom panel. But when creating a custom LinkedItemsSelectionExtenderBase (to display a different dialog when selecting linked items or images), you cannot access the panel nor can you make an API call to find the selected languages.

Using reflector, I've found that you have some ways to find the currently selected languages (via WebConfigurationManager or UserProfile), but the methods are internal making them unusable for partners.

As a workaround, I created a custom panel (inheriting LinkedItemsPanel). In the OnInit of that panel, I add the selected languages to the HttpContext (HttpContext.Current.Items["selectedLanguages"] = SelectedLanguages). From my dialog I simply do "var selectedLanguages = HttpContext.Current.Items["selectedLanguages"] as IEnumerable<string>;".

Although the workaround works in this scenario, it forces me to create a custom panel every time I use the custom dialog. So it would be nice (since you already have the api calls for this) if the SelectedLanguages would be available on a class like e.g. WebConfigurationManager.

API localization