Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Threading.Tasks;
using Sitecore.Commerce.Core;
using Sitecore.Commerce.EntityViews;
using Sitecore.Framework.Conditions;
using Sitecore.Framework.Pipelines;
namespace Sitecore.Services.Examples.Entities.Pipelines.Blocks
{
[PipelineDisplayName("GetBrandsNavigationView")]
public class GetBrandsNavigationViewBlock : PipelineBlock<EntityView, EntityView, CommercePipelineExecutionContext>
{
public override Task<EntityView> Run(EntityView entityView, CommercePipelineExecutionContext context)
{
Condition.Requires(entityView).IsNotNull($"{Name}: The argument cannot be null");
entityView.ChildViews.Add(new EntityView()
{
Name = "BrandsDashboard",//TODO : get from policy e.g. context.GetPolicy<KnownRelationshipViewsPolicy>().RelationshipsDashboard,
ItemId = "BrandsDashboard",//TODO : get from policy e.g. context.GetPolicy<KnownRelationshipViewsPolicy>().RelationshipsDashboard,
DisplayName = "Brands",
Icon = "link",
DisplayRank = 9
});
return Task.FromResult(entityView);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.