3

I was trying to make my existing JWPlayer module compatible with latest release of DXA. but i am having issues doing so.

In BinaryData\17\system\config jwplayer.schemas.json is not downloading, only core.schemas.json, i debug the code but did not find any code to download the custom module config files.

Reference to files is also zero in LocalizationData.cs enter image description here

So, i browsed the GitHub and compared localization.cs file & found following code snippet is missing from 1.3 + version, May be it has been moved somewhere else.

enter image description here

do anybody know the reason of not loading those files, due to which custom module is not working.

2

Since DXA 1.3, loading of config files is done "on-demand" (i.e. when config values are needed) instead of upfront (at "bootstrap" time). This improves startup performance.

So, indeed, the LocalizationData.ConfigStaticContentUrls property is not used anymore; config files are loaded when needed in Localization.LoadConfigSection.

AFAIK, config files named config\{module}.schemas.json are only used in DefaultProvider.MapSchema (which, in turn, is used by DefaultProvider.PopulateDynamicList) in order to translate a Semantic Schema symbolic name to a Schema ID (number).

For other semantic mapping purposes, the file mapping\schemas.json is used (and that one is supposed to contain semantic mapping data for all Schemas in all active modules).

| improve this answer | |
  • I thought same that it could be on demand, but my module which i created in 1.2 was not working so when i added below mentioned method, it is working fine. so not sure what trigger dxa to load the configs? could you clarify? or any change in the way module are created in 1.3+ – Raj Kumar Aug 15 '16 at 17:10
  • As mentioned, the config files are loaded as soon as a config value in them is accessed. See Localization.GetConfigValue. – Rick Pannekoek Aug 15 '16 at 18:33
  • Looks like working for me now, one module error was causing other modules to load. – Raj Kumar Aug 20 '16 at 10:06
0

After adding following method to Localization.cs, solved a bit but mappings/schema.json still not including schema fields from modules, no sure hows other modules are working post DXA 1.2

 private void LoadConfig(IEnumerable<string> configItemUrls)
        {
            _config = new Dictionary<string, IDictionary<string, string>>();
            foreach (string configItemUrl in configItemUrls)
            {
                string sectionName = configItemUrl.Substring(configItemUrl.LastIndexOf("/", StringComparison.Ordinal) + 1);
                sectionName = sectionName.Substring(0, sectionName.LastIndexOf(".", StringComparison.Ordinal)).ToLower();
                string jsonData = SiteConfiguration.ContentProvider.GetStaticContentItem(configItemUrl, this).GetText();
                Dictionary<string, string> settings = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonData);
                _config.Add(sectionName, settings);
            }
        }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.