Last active
August 14, 2019 21:09
-
-
Save fluxdigital/8ecb9f1ac6a23f8e43fcc7bc1217b86f to your computer and use it in GitHub Desktop.
creates a view rendering at the specified location and adds datasource, data template and cache settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Scaffold-View-Rendering([string]$renderingName, [string]$renderingPath, [string]$viewPath, [string]$dataSourcePath, [string]$dataSourceTemplate){ | |
###create rendering### | |
$renderingItem = New-Item -Path $renderingPath -Name $renderingName -ItemType "/sitecore/templates/System/Layout/Renderings/View rendering" | |
$renderingItem.Editing.BeginEdit(); | |
#set path | |
$renderingItem["Path"] = $viewPath; | |
#set default rendering icon | |
$renderingItem["__Icon"] = "/~/icon/office/32x32/element.png"; | |
#add datasource and datasource location | |
$renderingItem["Datasource Location"] = $dataSourcePath; | |
$renderingItem["Datasource Template"] = $dataSourceTemplate; | |
$renderingItem["Cacheable"] = 1; | |
$renderingItem["VaryByData"] = 1; | |
$renderingItem.Editing.EndEdit(); | |
Write-Host "Rendering Created & Configured: $($renderingItem.Name)"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment