Skip to content

Commit

Permalink
Fix disabling SectionTree for ScriptManager
Browse files Browse the repository at this point in the history
  • Loading branch information
kows authored Jun 30, 2023
1 parent 96a7e16 commit 2607d55
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@ public void Compose(IUmbracoBuilder builder)
builder.Services.AddSingleton(typeof(ISettingsService<ScriptManagerConfigModel>), typeof(ScriptManagerConfigurationService));

var disabledModules = section?.Get<ScriptManagerAppSettingsModel>()?.DisabledModules ?? Array.Empty<string>();

if (disabledModules.Contains(DisabledModuleConstant.All))
{
builder.Components().Append<DisableModuleComponent>();
builder.Trees().RemoveTreeController(typeof(ScriptManagerTreeController));
return;
} else if (disabledModules.Contains(DisabledModuleConstant.Trees)) {
builder.Trees().RemoveTreeController(typeof(ScriptManagerTreeController));
} else {
builder.ScriptDefinitions()
.Add<GoogleTagManagerDefinition>()
.Add<GoogleAnalyticsDefinition>()
.Add<HotjarDefinition>()
.Add<CustomScriptDefinition>();
}

builder.ScriptDefinitions()
.Add<GoogleTagManagerDefinition>()
.Add<GoogleAnalyticsDefinition>()
.Add<HotjarDefinition>()
.Add<CustomScriptDefinition>();

builder.Components().Append<EnableModuleComponent>();

builder.Services.AddScoped<IScriptRepository, ScriptRepository>();
Expand Down

0 comments on commit 2607d55

Please sign in to comment.