Skip to content

Instantly share code, notes, and snippets.

@neilkillen
Created August 28, 2020 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilkillen/65d742998bafa89fb50174f8b9e711ec to your computer and use it in GitHub Desktop.
Save neilkillen/65d742998bafa89fb50174f8b9e711ec to your computer and use it in GitHub Desktop.
$database = "master"
$selectedItem = Get-Item -Path (@{$true="$($database):\content\home"; $false="$($database):\content"}[(Test-Path -Path "$($database):\content\home")])
$props = @{
Parameters = @(
@{Name="selectedItem"; Title="Choose the Sitecore Item to to view its Renderings Settings"; Tooltip="All Final Renderings and their settings for this item wil be listed "; }
)
Title = "List Rendering Cache Settings for Content Item"
Description = "Please select Content Item"
Width = 550
Height = 300
ShowHints = $true
Icon = [regex]::Replace($PSScript.Appearance.Icon, "Office", "OfficeWhite", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
}
$result = Read-Variable @props
if($result -eq "cancel") {
exit
}
if ($selectedItem.length -ge 1) {
$selectedItemID = $selectedItem.ID
}
$defaultLayout = Get-LayoutDevice -Default
$selectedItem = Get-Item -Path "master:" -ID $selectedItemID
$Results = @();
$renderings = Get-Rendering -Item $selectedItem -Device $defaultLayout -FinalLayout
foreach($rendering in $renderings){
if($rendering.ItemID -ne $null)
{
$renderingItem = Get-Item master: -ID $rendering.ItemID
if($renderingItem -ne $null)
{
$Properties = @{
Page = $rootItem.Name
RenderingItemName = $renderingItem.Name
RenderingItemID = $renderingItem.ID
RenderingItemPath = $renderingItem.Paths.Path
Global_Cacheable = $renderingItem.Cacheable
Global_ClearOnIndexUpdate = $renderingItem.ClearOnIndexUpdate
Global_VaryByData = $renderingItem.VaryByData
Global_VaryByDevice = $renderingItem.VaryByDevice
Global_VaryByLogin = $renderingItem.VaryByLogin
Global_VaryByParm = $renderingItem.VaryByParm
Global_VaryByQueryString = $renderingItem.VaryByQueryString
Global_VaryByUser = $renderingItem.VaryByUser
}
$Results += New-Object psobject -Property $Properties
}
}
}
$Results | Select-Object Page, RenderingItemName,RenderingItemID,RenderingItemPath,Global_Cacheable, Global_ClearOnIndexUpdate, Global_VaryBy* | Show-ListView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment