Set-Rendering

Updates rendering with new values.

Syntax

Set-Rendering [-Item] <Item> -Instance <RenderingDefinition> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <String>] [-Index <Int32>] [-FinalLayout] [-Device <DeviceItem>] [-Language <String[]>]

Set-Rendering [-Path] <String> -Instance <RenderingDefinition> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <String>] [-Index <Int32>] [-FinalLayout] [-Device <DeviceItem>] [-Language <String[]>]

Set-Rendering -Id <String> [-Database <String>] -Instance <RenderingDefinition> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <String>] [-Index <Int32>] [-FinalLayout] [-Device <DeviceItem>] [-Language <String[]>]

Detailed Description

Updates rendering instance with new values. The instance should be earlier obtained using Get-Rendering.

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

Parameters

-Instance <RenderingDefinition>

Instance of the Rendering to be updated.

Aliases

Required?

true

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Parameter <Hashtable>

Rendering Parameters to be overriden on the Rendering that is being updated - if not specified the value provided in rendering definition specified in the Instance parameter will be used.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PlaceHolder <String>

Placeholder path the Rendering should be added to - if not specified the value provided in rendering definition specified in the Instance parameter will be used.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DataSource <String>

Data source of the Rendering - if not specified the value provided in rendering definition specified in the Instance parameter will be used.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Index <Int32>

If provided the rendering will be moved to the specified index.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FinalLayout <SwitchParameter>

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

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Device <DeviceItem>

Specifies the target device when applying the rendering changes.

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Language <String[]>

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Item <Item>

The item to be processed.

Aliases

Required?

true

Position?

1

Default Value

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Path <String>

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

Aliases

Required?

true

Position?

1

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Id <String>

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

Aliases

Required?

true

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Database <String>

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

Aliases

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

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

Change all rendering's placeholder from main to footer.

$item = Get-Item -Path master:\content\home
Get-Rendering -Item $item -PlaceHolder "main" | 
    Foreach-Object { 
        $_.Placeholder = "footer"; 
        Set-Rendering -Item $item -Instance $_
    }

EXAMPLE 2

Clear the datasource value for a rendering.

$item = Get-Item -Path master:\content\home
Get-Rendering -Item $item -PlaceHolder "main" | 
    Foreach-Object { 
        $_.DataSource = $null 
        Set-Rendering -Item $item -Instance $_
    }

Last updated