Closed pierresapinault-ef closed 5 years ago
@pierresapinault-ef Do you have the necessary code to do this via C#? If so, we could easily add a command to help do that via SPE.
Hi, I don't have had time to look into making one. For now the solution we went for was to process the __Renderings field as an xml and remove the whole part that matches the Device ID we are targeting, It's basically doing the same since there cannot be renderings without a layout we just end up wiping the whole device. best, Pierre
Hopefully #1111 will address this for you in the future.
Expected Behavior
I would like to know if there is a way to also remove the layout from multiple items the same way we can remove renderings by invoking Remove-Rendering cmdlets.
Actual Behavior
Not sure how to achieve this currently, we only remove renderings and then manually remove the layout
Steps to Reproduce the Problem
Sitecore PowerShell Extensions 4.0.0.26858 Sitecore 7.2 Windows PowerShell 4.0
I couldn't find any answer from the internet so posting in here..
For now we tried 2 methods that don't really cut it:
1) Do a loop and remove each rendering from that device, but you need to manually remove the layout afterwards function RemoveRenderings ($items) { foreach ($item in $items){ $renderings = $items | Get-Rendering -Device $device
} }
2) Update/create the standard value item of the template you are targeting and remove everything you don't want there (only do it once then), then invoke the Reset-Layout method that ships with Sitecore PS. The issue here is that it will reset all devices of course, remove the unnecessary, but also for the one you want to keep you will need to remap all the datasources
Any input is greatly appreciated as usual, thank you for this great tool!
best, Pierre S.