Skip to content

Fix 'Add-Rendering' command when rendering parameters are provided. #1378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Spe/Commands/Presentation/AddRenderingCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ protected override void ProcessLayout(Item item, LayoutDefinition layout, Device
if (Parameter != null && Parameter.Keys.Count > 0)
{
var parameters = new UrlString(rendering.Parameters ?? string.Empty);
var renderingItem = Sitecore.Client.ContentDatabase.GetItem(Instance.ItemID);
var renderingItem = item.Database.GetItem(Instance.ItemID);
if(renderingItem == null)
{
WriteError(new ItemNotFoundException($"The rendering with Id {Instance.ItemID} could not be found in the ContentDatabase."), ErrorIds.ItemNotFound, ErrorCategory.ObjectNotFound, this);
WriteError(new ItemNotFoundException($"The rendering with Id {Instance.ItemID} could not be found in context database."), ErrorIds.ItemNotFound, ErrorCategory.ObjectNotFound, this);
return;
}

Expand Down