Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilkillen/7ddfb998fc5ec62ec6ec5788db5840e0 to your computer and use it in GitHub Desktop.
Save neilkillen/7ddfb998fc5ec62ec6ec5788db5840e0 to your computer and use it in GitHub Desktop.
protected ItemModel GetBucketItem(object identifierValue, IItemModelRepository repository,
Plugins.ResolveSitecoreItemSettings resolveItemSettings, PipelineContext pipelineContext)
{
string[] identifierSegments = identifierValue.ToString().Split(new[] { '-' });
var itemPath = string.Join("/", identifierSegments, 0, resolveItemSettings.BucketFolderDepth);
var bucketItemPath = resolveItemSettings.BucketRootPath + itemPath + "/" + identifierValue;
ItemModel itemModel = repository.Get(bucketItemPath);
if (itemModel != null)
{
Log(
pipelineContext.Logger.Warn,
pipelineContext,
$"Item found in Bucket: {resolveItemSettings.BucketRootPath}",
$"identifier: {identifierValue}",
$"item id: {itemModel["ItemID"]}");
return itemModel;
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment