Skip to main content
added 20 characters in body; edited tags; edited title
Source Link
Marek Musielak
  • 24.2k
  • 3
  • 31
  • 64

Sitecore.Mvc.Analytics 10.3 doesn't contain a definationdefinition for Sitecore.Mvc.Analytics.Pipelines.Response.Customize RenderingCustomizeRendering

using Sitecore.Data.Items; using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering; using Sitecore.Pipelines; using Sitecore.Pipelines.ResolveRenderingDatasource;

public class CustomMVCResolveRenderingDataSource : CustomizeRenderingProcessor { public override void Process(CustomizeRenderingArgs args) { var rendering = args.Rendering; //Get the Site Item var contextSiteItem = GetSiteItem(Context.Item);

using Sitecore.Data.Items;
using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering;
using Sitecore.Pipelines;
using Sitecore.Pipelines.ResolveRenderingDatasource;

public class CustomMVCResolveRenderingDataSource : CustomizeRenderingProcessor
{
    public override void Process(CustomizeRenderingArgs args)
    {
        var rendering = args.Rendering;
        //Get the Site Item
        var contextSiteItem = GetSiteItem(Context.Item);

        if (!string.IsNullOrEmpty(rendering.DataSource) && contextSiteItem != null)
        {
            if (rendering.DataSource.Contains("$SiteName"))
            {
                rendering.DataSource = rendering.DataSource.Replace("$SiteName", contextSiteItem.Name);
                Item sourceItem = Context.Database.GetItem(rendering.DataSource);
                if (sourceItem != null)
                {
                    rendering.DataSource = sourceItem.ID.ToString();
                }
            }
        }
        //Initialize the resolved DataSource to ResolveRenderingDatasourceArgs
        var renderingDSArgs = new ResolveRenderingDatasourceArgs(rendering.DataSource);
        CorePipeline.Run("resolveRenderingDatasource", renderingDSArgs);
        rendering.DataSource = renderingDSArgs.Datasource;
    }
}

}

Sitecore.Mvc.Analytics 10.3 doesn't contain a defination for Sitecore.Mvc.Analytics.Pipelines.Response.Customize Rendering

using Sitecore.Data.Items; using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering; using Sitecore.Pipelines; using Sitecore.Pipelines.ResolveRenderingDatasource;

public class CustomMVCResolveRenderingDataSource : CustomizeRenderingProcessor { public override void Process(CustomizeRenderingArgs args) { var rendering = args.Rendering; //Get the Site Item var contextSiteItem = GetSiteItem(Context.Item);

        if (!string.IsNullOrEmpty(rendering.DataSource) && contextSiteItem != null)
        {
            if (rendering.DataSource.Contains("$SiteName"))
            {
                rendering.DataSource = rendering.DataSource.Replace("$SiteName", contextSiteItem.Name);
                Item sourceItem = Context.Database.GetItem(rendering.DataSource);
                if (sourceItem != null)
                {
                    rendering.DataSource = sourceItem.ID.ToString();
                }
            }
        }
        //Initialize the resolved DataSource to ResolveRenderingDatasourceArgs
        var renderingDSArgs = new ResolveRenderingDatasourceArgs(rendering.DataSource);
        CorePipeline.Run("resolveRenderingDatasource", renderingDSArgs);
        rendering.DataSource = renderingDSArgs.Datasource;
    }

}

Sitecore.Mvc.Analytics 10.3 doesn't contain a definition for Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering

using Sitecore.Data.Items;
using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering;
using Sitecore.Pipelines;
using Sitecore.Pipelines.ResolveRenderingDatasource;

public class CustomMVCResolveRenderingDataSource : CustomizeRenderingProcessor
{
    public override void Process(CustomizeRenderingArgs args)
    {
        var rendering = args.Rendering;
        //Get the Site Item
        var contextSiteItem = GetSiteItem(Context.Item);

        if (!string.IsNullOrEmpty(rendering.DataSource) && contextSiteItem != null)
        {
            if (rendering.DataSource.Contains("$SiteName"))
            {
                rendering.DataSource = rendering.DataSource.Replace("$SiteName", contextSiteItem.Name);
                Item sourceItem = Context.Database.GetItem(rendering.DataSource);
                if (sourceItem != null)
                {
                    rendering.DataSource = sourceItem.ID.ToString();
                }
            }
        }
        //Initialize the resolved DataSource to ResolveRenderingDatasourceArgs
        var renderingDSArgs = new ResolveRenderingDatasourceArgs(rendering.DataSource);
        CorePipeline.Run("resolveRenderingDatasource", renderingDSArgs);
        rendering.DataSource = renderingDSArgs.Datasource;
    }
}
Source Link

Sitecore.Mvc.Analytics 10.3 doesn't contain a defination for Sitecore.Mvc.Analytics.Pipelines.Response.Customize Rendering

using Sitecore.Data.Items; using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering; using Sitecore.Pipelines; using Sitecore.Pipelines.ResolveRenderingDatasource;

public class CustomMVCResolveRenderingDataSource : CustomizeRenderingProcessor { public override void Process(CustomizeRenderingArgs args) { var rendering = args.Rendering; //Get the Site Item var contextSiteItem = GetSiteItem(Context.Item);

        if (!string.IsNullOrEmpty(rendering.DataSource) && contextSiteItem != null)
        {
            if (rendering.DataSource.Contains("$SiteName"))
            {
                rendering.DataSource = rendering.DataSource.Replace("$SiteName", contextSiteItem.Name);
                Item sourceItem = Context.Database.GetItem(rendering.DataSource);
                if (sourceItem != null)
                {
                    rendering.DataSource = sourceItem.ID.ToString();
                }
            }
        }
        //Initialize the resolved DataSource to ResolveRenderingDatasourceArgs
        var renderingDSArgs = new ResolveRenderingDatasourceArgs(rendering.DataSource);
        CorePipeline.Run("resolveRenderingDatasource", renderingDSArgs);
        rendering.DataSource = renderingDSArgs.Datasource;
    }

}