diff --git a/source/nuPickers/Shared/CustomLabel/CustomLabel.cs b/source/nuPickers/Shared/CustomLabel/CustomLabel.cs
index 87f9bfb..a3fe6fb 100644
--- a/source/nuPickers/Shared/CustomLabel/CustomLabel.cs
+++ b/source/nuPickers/Shared/CustomLabel/CustomLabel.cs
@@ -3,8 +3,10 @@
using System.Linq;
using System.Web;
using nuPickers.Shared.Editor;
+using Umbraco.Core.Dictionary;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
+using Umbraco.Web;
using Umbraco.Web.Composing;
namespace nuPickers.Shared.CustomLabel
@@ -23,14 +25,20 @@ internal class CustomLabel
private string PropertyAlias { get; set; }
+
+
+ private readonly IUmbracoComponentRenderer _componentRenderer;
+
///
///
///
/// alias of Macro to execute
/// node, media or member id
/// property alias
- internal CustomLabel(string macroAlias, int contextId, string propertyAlias)
+ internal CustomLabel(string macroAlias, int contextId, string propertyAlias, IUmbracoComponentRenderer componentRenderer)
{
+ _componentRenderer = componentRenderer;
+
MacroAlias = macroAlias;
ContextId = contextId;
PropertyAlias = propertyAlias;
@@ -52,6 +60,7 @@ internal CustomLabel(string macroAlias, int contextId, string propertyAlias)
if (contextNode != null)
{
HttpContext.Current.Items["pageID"] = contextNode.Id;
+ ContextId = contextNode.Id;
HasMacroContext = true;
}
}
@@ -118,7 +127,7 @@ private string ProcessMacro(string key, string label, string keys, int counter,
///
private string RenderToString(Macro macro, Dictionary properties)
{
- return Current.UmbracoHelper.RenderMacro(macro.Alias, properties).ToHtmlString();
+ return _componentRenderer.RenderMacro(ContextId, macro.Alias, properties).ToHtmlString();
}
}
}
\ No newline at end of file
diff --git a/source/nuPickers/Shared/Editor/Editor.cs b/source/nuPickers/Shared/Editor/Editor.cs
index 8509fd1..998933d 100644
--- a/source/nuPickers/Shared/Editor/Editor.cs
+++ b/source/nuPickers/Shared/Editor/Editor.cs
@@ -10,9 +10,20 @@ namespace nuPickers.Shared.Editor
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
+ using Umbraco.Core.Composing;
+ using Umbraco.Web;
internal static class Editor
{
+
+ public static IFactory Factory
+ => Umbraco.Core.Composing.Current.Factory;
+
+ public static IUmbracoComponentRenderer UmbracoComponentRenderer
+ => Factory.GetInstance();
+
+
+
///
/// Get a collection of all the (key/label) items for a picker (with optional typeahead)
///
@@ -39,7 +50,7 @@ internal static IEnumerable GetEditorDataItems(
if (!string.IsNullOrWhiteSpace(customLabelMacro))
{
- editorDataItems = new CustomLabel(customLabelMacro, currentId, propertyAlias).ProcessEditorDataItems(editorDataItems);
+ editorDataItems = new CustomLabel(customLabelMacro, currentId, propertyAlias, UmbracoComponentRenderer).ProcessEditorDataItems(editorDataItems);
}
// if the datasource didn't handle the typeahead text, then it needs to be done here (post custom label processing ?)
@@ -78,7 +89,7 @@ internal static IEnumerable GetEditorDataItems(
if (!string.IsNullOrWhiteSpace(customLabelMacro))
{
- editorDataItems = new CustomLabel(customLabelMacro, currentId, propertyAlias).ProcessEditorDataItems(editorDataItems);
+ editorDataItems = new CustomLabel(customLabelMacro, currentId, propertyAlias, UmbracoComponentRenderer).ProcessEditorDataItems(editorDataItems);
}
// ensure sort order matches order of keys supplied
@@ -122,7 +133,7 @@ internal static IEnumerable GetEditorDataItems(
if (!string.IsNullOrWhiteSpace(customLabelMacro))
{
- editorDataItems = new CustomLabel(customLabelMacro, currentId, propertyAlias).ProcessEditorDataItems(editorDataItems);
+ editorDataItems = new CustomLabel(customLabelMacro, currentId, propertyAlias, UmbracoComponentRenderer).ProcessEditorDataItems(editorDataItems);
}
}
diff --git a/source/nuPickers/Shared/RelationMapping/RelationMapping.cs b/source/nuPickers/Shared/RelationMapping/RelationMapping.cs
index 46981c2..45b8b54 100644
--- a/source/nuPickers/Shared/RelationMapping/RelationMapping.cs
+++ b/source/nuPickers/Shared/RelationMapping/RelationMapping.cs
@@ -96,13 +96,13 @@ internal static void UpdateRelationMapping(int contextId, string propertyAlias,
}
// check current context is of the correct object type (as according to the relation type)
- if (Current.Services.EntityService.GetObjectType(contextId) == ObjectTypes.GetUmbracoObjectType(relationType.ChildObjectType))
+ if (Current.Services.EntityService.GetObjectType(contextId) == ObjectTypes.GetUmbracoObjectType(relationType.ChildObjectType.Value))
{
// for each picked item
foreach (int pickedId in pickedIds)
{
// check picked item context if of the correct object type (as according to the relation type)
- if (Current.Services.EntityService.GetObjectType(pickedId) == ObjectTypes.GetUmbracoObjectType(relationType.ParentObjectType))
+ if (Current.Services.EntityService.GetObjectType(pickedId) == ObjectTypes.GetUmbracoObjectType(relationType.ParentObjectType.Value))
{
// if relation doesn't already exist (new picked item)
if (!relations.Exists(x => x.ParentId == pickedId))
diff --git a/source/nuPickers/nuPickers.csproj b/source/nuPickers/nuPickers.csproj
index 2f5bbee..fe05688 100644
--- a/source/nuPickers/nuPickers.csproj
+++ b/source/nuPickers/nuPickers.csproj
@@ -38,13 +38,11 @@
..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll
-
- ..\packages\ClientDependency.1.9.7\lib\net45\ClientDependency.Core.dll
- True
+
+ ..\packages\ClientDependency.1.9.9\lib\net45\ClientDependency.Core.dll
-
- ..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll
- True
+
+ ..\packages\ClientDependency-Mvc5.1.9.3\lib\net45\ClientDependency.Core.Mvc.dll
..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll
@@ -53,9 +51,8 @@
..\packages\CSharpTest.Net.Collections.14.906.1403.1082\lib\net40\CSharpTest.Net.Collections.dll
True
-
- ..\packages\Examine.1.0.0\lib\net452\Examine.dll
- True
+
+ ..\packages\Examine.1.0.2\lib\net452\Examine.dll
..\packages\HtmlAgilityPack.1.8.14\lib\Net45\HtmlAgilityPack.dll
@@ -290,21 +287,20 @@
-
- ..\packages\UmbracoCms.Core.8.1.1\lib\net472\Umbraco.Core.dll
- True
+
+ ..\packages\UmbracoCms.Core.8.6.1\lib\net472\Umbraco.Core.dll
-
- ..\packages\UmbracoCms.Web.8.1.1\lib\net472\Umbraco.Examine.dll
- True
+
+ ..\packages\UmbracoCms.Web.8.6.1\lib\net472\Umbraco.Examine.dll
-
- ..\packages\UmbracoCms.Web.8.1.1\lib\net472\Umbraco.Web.dll
- True
+
+ ..\packages\UmbracoCms.Web.8.6.1\lib\net472\Umbraco.ModelsBuilder.Embedded.dll
-
- ..\packages\UmbracoCms.Web.8.1.1\lib\net472\Umbraco.Web.UI.dll
- True
+
+ ..\packages\UmbracoCms.Web.8.6.1\lib\net472\Umbraco.Web.dll
+
+
+ ..\packages\UmbracoCms.Web.8.6.1\lib\net472\Umbraco.Web.UI.dll
diff --git a/source/nuPickers/packages.config b/source/nuPickers/packages.config
index 85d862f..7c9c87b 100644
--- a/source/nuPickers/packages.config
+++ b/source/nuPickers/packages.config
@@ -1,11 +1,11 @@
-
+
-
+
-
+
@@ -57,7 +57,7 @@
-
-
+
+
\ No newline at end of file