All pages
Powered by GitBook
1 of 1

Set-Layout

Sets item layout for a device.

Syntax

Detailed Description

Sets item layout for a specific device provided

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Device <DeviceItem>

Device for which to set layout.

-Layout <Item>

Sitecore item defining the layout.

-FinalLayout <SwitchParameter>

Targets the Final Layout. If not provided, the Shared Layout will be targeted. Applies to Sitecore 8.0 and higher only.

-Language <String[]>

-Item <Item>

The item to be processed.

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Sitecore.Data.Items.Item

Notes

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

# where my test page will go
$path = 'master:\content\Sample'

# wipe and re-create it if exists
if(Test-Path $path){
    Remove-Item $path
}
$item = New-Item -Path $path -ItemType "Sample/Sample Item"

# select default layout
$device = Get-LayoutDevice -Default

# and a layout we will change to
$layout = Get-Item -Path 'master:\layout\Layouts\System\Simulated Device Layout'

# change the layout from what is in Standard values to the new one.
Set-Layout -Item $item -Device $device -Layout $layout | Out-Null

# verify
Get-Layout $item  

Related Topics