Last active
April 26, 2019 04:03
-
-
Save neilkillen/7ddfb998fc5ec62ec6ec5788db5840e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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