From ced8a96d0fb8357a3713befc956f9889b6ab00df Mon Sep 17 00:00:00 2001 From: Michael West Date: Fri, 8 May 2020 16:28:27 -0500 Subject: [PATCH] Added experimental feature to disable the expansion of properties. This comes into play if you want to prevent items from getting Automatic properties. --- src/Spe/Core/Data/DisablePropertyExpander.cs | 9 +++++++++ src/Spe/Core/Extensions/ItemShellExtensions.cs | 4 ++++ src/Spe/Spe.csproj | 1 + 3 files changed, 14 insertions(+) create mode 100644 src/Spe/Core/Data/DisablePropertyExpander.cs diff --git a/src/Spe/Core/Data/DisablePropertyExpander.cs b/src/Spe/Core/Data/DisablePropertyExpander.cs new file mode 100644 index 000000000..58ff21d34 --- /dev/null +++ b/src/Spe/Core/Data/DisablePropertyExpander.cs @@ -0,0 +1,9 @@ +using Sitecore.Common; + +namespace Spe.Core.Data +{ + public class DisablePropertyExpander : Switcher + { + public DisablePropertyExpander() : base(true) { } + } +} \ No newline at end of file diff --git a/src/Spe/Core/Extensions/ItemShellExtensions.cs b/src/Spe/Core/Extensions/ItemShellExtensions.cs index 23d3f552c..29185b186 100644 --- a/src/Spe/Core/Extensions/ItemShellExtensions.cs +++ b/src/Spe/Core/Extensions/ItemShellExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Management.Automation; +using Sitecore.Common; using Sitecore.Data; using Sitecore.Data.Events; using Sitecore.Data.Fields; @@ -9,6 +10,7 @@ using Sitecore.Diagnostics; using Sitecore.Events; using Sitecore.Resources.Media; +using Spe.Core.Data; using Spe.Core.Settings; namespace Spe.Core.Extensions @@ -34,6 +36,8 @@ internal static PSObject GetPsObject(SessionState provider, Item item) { var psObject = PSObject.AsPSObject(item); + if (Switcher.CurrentValue) return psObject; + Dictionary propertySet; if (AllPropertySets.ContainsKey(item.TemplateID)) { diff --git a/src/Spe/Spe.csproj b/src/Spe/Spe.csproj index 479d11217..f469b3bbd 100644 --- a/src/Spe/Spe.csproj +++ b/src/Spe/Spe.csproj @@ -214,6 +214,7 @@ +