diff --git a/src/Sitecore.Support.430451/App_Config/Include/zzz/Sitecore.Support.430451.config b/src/Sitecore.Support.430451/App_Config/Include/zzz/Sitecore.Support.430451.config
index 07a20b1..e7798a2 100644
--- a/src/Sitecore.Support.430451/App_Config/Include/zzz/Sitecore.Support.430451.config
+++ b/src/Sitecore.Support.430451/App_Config/Include/zzz/Sitecore.Support.430451.config
@@ -1,4 +1,9 @@
+
+
+ Sitecore.Support.XA.Foundation.Mvc.Wrappers.Rendering, Sitecore.Support.430451
+
+
\ No newline at end of file
diff --git a/src/Sitecore.Support.430451/Rendering.cs b/src/Sitecore.Support.430451/Rendering.cs
index be7e473..416cd8c 100644
--- a/src/Sitecore.Support.430451/Rendering.cs
+++ b/src/Sitecore.Support.430451/Rendering.cs
@@ -1,7 +1,9 @@
-namespace Sitecore.XA.Foundation.Mvc.Wrappers
+namespace Sitecore.Support.XA.Foundation.Mvc.Wrappers
{
+ using Microsoft.Extensions.DependencyInjection;
using Sitecore.Data;
using Sitecore.Data.Items;
+ using Sitecore.DependencyInjection;
using Sitecore.Mvc.Presentation;
using Sitecore.XA.Foundation.Mvc;
using Sitecore.XA.Foundation.Mvc.Wrappers;
@@ -16,23 +18,11 @@ public class Rendering : IRendering
public RenderingProperties Properties => _sitecoreRendering.Properties;
- public Item Item
- {
- get
- {
- Item item = DataSourceItem;
- if (item == null)
- {
- RenderingModel obj = _sitecoreRendering.Model as RenderingModel;
- if (obj == null)
- {
- return null;
- }
- item = obj.PageItem;
- }
- return item;
- }
- }
+ private IPageContext _pageContext;
+
+ protected virtual IPageContext PageContext => _pageContext ?? (_pageContext = ServiceProviderServiceExtensions.GetService(ServiceLocator.ServiceProvider));
+
+ public Item Item => DataSourceItem ?? PageContext.Current;
public Item DataSourceItem
{
diff --git a/src/Sitecore.Support.430451/Sitecore.Support.430451.csproj b/src/Sitecore.Support.430451/Sitecore.Support.430451.csproj
index 8f6a782..2dcc260 100644
--- a/src/Sitecore.Support.430451/Sitecore.Support.430451.csproj
+++ b/src/Sitecore.Support.430451/Sitecore.Support.430451.csproj
@@ -42,6 +42,14 @@
4
+
+ ..\packages\SC.Microsoft.Extensions.DependencyInjection.9.0.2\lib\Microsoft.Extensions.DependencyInjection.dll
+ False
+
+
+ ..\packages\SC.Microsoft.Extensions.DependencyInjection.Abstractions.9.0.2\lib\Microsoft.Extensions.DependencyInjection.Abstractions.dll
+ False
+
..\packages\SC.Sitecore.Kernel.9.0.2\lib\Sitecore.Kernel.dll
False
diff --git a/src/Sitecore.Support.430451/packages.config b/src/Sitecore.Support.430451/packages.config
index a42771b..1c8b6c2 100644
--- a/src/Sitecore.Support.430451/packages.config
+++ b/src/Sitecore.Support.430451/packages.config
@@ -1,5 +1,7 @@
+
+