Skip to content

Commit ced8a96

Browse files
committed
Added experimental feature to disable the expansion of properties.
This comes into play if you want to prevent items from getting Automatic properties.
1 parent 7453ba8 commit ced8a96

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Sitecore.Common;
2+
3+
namespace Spe.Core.Data
4+
{
5+
public class DisablePropertyExpander : Switcher<bool, DisablePropertyExpander>
6+
{
7+
public DisablePropertyExpander() : base(true) { }
8+
}
9+
}

src/Spe/Core/Extensions/ItemShellExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Management.Automation;
5+
using Sitecore.Common;
56
using Sitecore.Data;
67
using Sitecore.Data.Events;
78
using Sitecore.Data.Fields;
89
using Sitecore.Data.Items;
910
using Sitecore.Diagnostics;
1011
using Sitecore.Events;
1112
using Sitecore.Resources.Media;
13+
using Spe.Core.Data;
1214
using Spe.Core.Settings;
1315

1416
namespace Spe.Core.Extensions
@@ -34,6 +36,8 @@ internal static PSObject GetPsObject(SessionState provider, Item item)
3436
{
3537
var psObject = PSObject.AsPSObject(item);
3638

39+
if (Switcher<bool, DisablePropertyExpander>.CurrentValue) return psObject;
40+
3741
Dictionary<ID, string> propertySet;
3842
if (AllPropertySets.ContainsKey(item.TemplateID))
3943
{

src/Spe/Spe.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214
<Compile Include="Commands\Presentation\AddPlaceholderSettingCommand.cs" />
215215
<Compile Include="Commands\Presentation\NewPlaceholderSettingCommand.cs" />
216216
<Compile Include="Commands\Security\Accounts\BaseSecurityCommand.cs" />
217+
<Compile Include="Core\Data\DisablePropertyExpander.cs" />
217218
<Compile Include="Core\Extensions\CustomFieldAccessor.cs" />
218219
<Compile Include="Core\Extensions\ExpressionExtensions.cs" />
219220
<Compile Include="Core\Extensions\EnumerableExtensions.cs" />

0 commit comments

Comments
 (0)