diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index 356b1076c7..200db76d04 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -151,7 +151,7 @@ namespace Umbraco.Tests.PublishedContent public void Position() { var items = UmbracoContext.Current.ContentCache.GetAtRoot() - .Where(x => x.GetPropertyValue("prop1") == 1234) + .Where(x => x.Value("prop1") == 1234) .ToIndexedArray(); Assert.IsTrue(items.First().IsFirst()); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs index c6f4e2bcc8..6c80fbde0f 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs @@ -259,7 +259,7 @@ namespace Umbraco.Tests.PublishedContent #endregion - public int Prop1 => this.GetPropertyValue("prop1"); + public int Prop1 => this.Value("prop1"); } [PublishedContentModel("ContentType2Sub")] @@ -280,7 +280,7 @@ namespace Umbraco.Tests.PublishedContent : base(content) { } - public int StrongValue => this.GetPropertyValue("strongValue"); + public int StrongValue => this.Value("strongValue"); } class PublishedContentStrong1Sub : PublishedContentStrong1 @@ -289,7 +289,7 @@ namespace Umbraco.Tests.PublishedContent : base(content) { } - public int AnotherValue => this.GetPropertyValue("anotherValue"); + public int AnotherValue => this.Value("anotherValue"); } class PublishedContentStrong2 : PublishedContentModel @@ -298,7 +298,7 @@ namespace Umbraco.Tests.PublishedContent : base(content) { } - public int StrongValue => this.GetPropertyValue("strongValue"); + public int StrongValue => this.Value("strongValue"); } class AutoPublishedContentType : PublishedContentType diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index c4a33854bd..37814c3b6d 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -292,8 +292,8 @@ namespace Umbraco.Tests.PublishedContent public void GetPropertyValueRecursiveTest() { var doc = GetNode(1174); - var rVal = doc.GetPropertyValue("testRecursive", true); - var nullVal = doc.GetPropertyValue("DoNotFindThis", true); + var rVal = doc.Value("testRecursive", true); + var nullVal = doc.Value("DoNotFindThis", true); Assert.AreEqual("This is the recursive val", rVal); Assert.AreEqual(null, nullVal); } @@ -303,15 +303,15 @@ namespace Umbraco.Tests.PublishedContent { var doc = GetNode(1173); - var propVal = doc.GetPropertyValue("content"); + var propVal = doc.Value("content"); Assert.IsInstanceOf(typeof(IHtmlString), propVal); Assert.AreEqual("
This is some content
", propVal.ToString()); - var propVal2 = doc.GetPropertyValue("content"); + var propVal2 = doc.Value("content"); Assert.IsInstanceOf(typeof(IHtmlString), propVal2); Assert.AreEqual("
This is some content
", propVal2.ToString()); - var propVal3 = doc.GetPropertyValue("Content"); + var propVal3 = doc.Value("Content"); Assert.IsInstanceOf(typeof(IHtmlString), propVal3); Assert.AreEqual("
This is some content
", propVal3.ToString()); } @@ -324,7 +324,7 @@ namespace Umbraco.Tests.PublishedContent var result = doc.Ancestors().OrderBy(x => x.Level) .Single() .Descendants() - .FirstOrDefault(x => x.GetPropertyValue("selectedNodes", "").Split(',').Contains("1173")); + .FirstOrDefault(x => x.Value("selectedNodes", "").Split(',').Contains("1173")); Assert.IsNotNull(result); } @@ -581,11 +581,11 @@ namespace Umbraco.Tests.PublishedContent { } - public string Legend => this.GetPropertyValue("legend"); + public string Legend => this.Value("legend"); - public IPublishedContent Image => this.GetPropertyValue("image"); + public IPublishedContent Image => this.Value("image"); - public int Size => this.GetPropertyValue("size"); + public int Size => this.Value("size"); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs index ba3a8adc21..1fe2425cc2 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs @@ -92,15 +92,15 @@ namespace Umbraco.Tests.PublishedContent var publishedMedia = GetNode(media.Id); - var propVal = publishedMedia.GetPropertyValue("content"); + var propVal = publishedMedia.Value("content"); Assert.IsInstanceOf(propVal); Assert.AreEqual("
This is some content
", propVal.ToString()); - var propVal2 = publishedMedia.GetPropertyValue("content"); + var propVal2 = publishedMedia.Value("content"); Assert.IsInstanceOf(propVal2); Assert.AreEqual("
This is some content
", propVal2.ToString()); - var propVal3 = publishedMedia.GetPropertyValue("Content"); + var propVal3 = publishedMedia.Value("Content"); Assert.IsInstanceOf(propVal3); Assert.AreEqual("
This is some content
", propVal3.ToString()); } diff --git a/src/Umbraco.Tests/PublishedContent/StronglyTypedModels/TypedModelBase.cs b/src/Umbraco.Tests/PublishedContent/StronglyTypedModels/TypedModelBase.cs index 862c8f48cb..0f5c1bd371 100644 --- a/src/Umbraco.Tests/PublishedContent/StronglyTypedModels/TypedModelBase.cs +++ b/src/Umbraco.Tests/PublishedContent/StronglyTypedModels/TypedModelBase.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Reflection; using System.Linq; using Umbraco.Core; -using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Web; @@ -48,7 +47,7 @@ namespace Umbraco.Tests.PublishedContent.StronglyTypedModels protected T Resolve(string propertyTypeAlias) { - return Content.GetPropertyValue(propertyTypeAlias); + return Content.Value(propertyTypeAlias); } protected T Resolve(MethodBase methodBase, T ifCannotConvert) @@ -59,7 +58,7 @@ namespace Umbraco.Tests.PublishedContent.StronglyTypedModels protected T Resolve(string propertyTypeAlias, T ifCannotConvert) { - return Content.GetPropertyValue(propertyTypeAlias, false, ifCannotConvert); + return Content.Value(propertyTypeAlias, false, ifCannotConvert); } protected T Resolve(MethodBase methodBase, bool recursive, T ifCannotConvert) @@ -70,7 +69,7 @@ namespace Umbraco.Tests.PublishedContent.StronglyTypedModels protected T Resolve(string propertyTypeAlias, bool recursive, T ifCannotConvert) { - return Content.GetPropertyValue(propertyTypeAlias, recursive, ifCannotConvert); + return Content.Value(propertyTypeAlias, recursive, ifCannotConvert); } #endregion diff --git a/src/Umbraco.Web/IUmbracoComponentRenderer.cs b/src/Umbraco.Web/IUmbracoComponentRenderer.cs index c7bf329a7f..0c6c1a775e 100644 --- a/src/Umbraco.Web/IUmbracoComponentRenderer.cs +++ b/src/Umbraco.Web/IUmbracoComponentRenderer.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Web; -using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; namespace Umbraco.Web @@ -40,33 +39,5 @@ namespace Umbraco.Web /// The parameters. /// IHtmlString RenderMacro(string alias, IDictionary parameters); - - /// - /// Renders an field to the template - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - //// - /// - IHtmlString Field(IPublishedContent currentPage, string fieldAlias, - string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", - bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, - RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, - RenderFieldEncodingType encoding = RenderFieldEncodingType.Unchanged, - bool formatAsDate = false, - bool formatAsDateWithTime = false, - string formatAsDateWithTimeSeparator = ""); } } \ No newline at end of file diff --git a/src/Umbraco.Web/IUmbracoComponentRendererWithField.cs b/src/Umbraco.Web/IUmbracoComponentRendererWithField.cs new file mode 100644 index 0000000000..103e5b5b50 --- /dev/null +++ b/src/Umbraco.Web/IUmbracoComponentRendererWithField.cs @@ -0,0 +1,39 @@ +using System.Web; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Web +{ + /// + /// Methods used to render umbraco components as HTML in templates + /// + public interface IUmbracoComponentRendererWithField : IUmbracoComponentRenderer + { + /// + /// Renders an field to the template + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + //// + /// + IHtmlString Field(IPublishedContent currentPage, string fieldAlias, + string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", + bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, + RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, + RenderFieldEncodingType encoding = RenderFieldEncodingType.Unchanged, + bool formatAsDate = false, + bool formatAsDateWithTime = false, + string formatAsDateWithTimeSeparator = ""); + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs index a1248d9343..507f1fec8b 100644 --- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs +++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs @@ -123,7 +123,7 @@ namespace Umbraco.Web return string.Empty; //get the default obj from the value converter - var cropperValue = mediaItem.GetPropertyValue(propertyAlias); + var cropperValue = mediaItem.Value(propertyAlias); //is it strongly typed? var stronglyTyped = cropperValue as ImageCropDataSet; diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs index e1e6692006..dd5912230d 100644 --- a/src/Umbraco.Web/Macros/MacroRenderer.cs +++ b/src/Umbraco.Web/Macros/MacroRenderer.cs @@ -553,7 +553,7 @@ namespace Umbraco.Web.Macros { var content = cache.GetById(int.Parse(splitpath[i])); if (content == null) continue; - value = content.GetPropertyValue(name)?.ToString(); + value = content.Value(name)?.ToString(); if (string.IsNullOrEmpty(value) == false) break; } diff --git a/src/Umbraco.Web/Media/ImageUrl.cs b/src/Umbraco.Web/Media/ImageUrl.cs index dff9358a38..c0271167aa 100644 --- a/src/Umbraco.Web/Media/ImageUrl.cs +++ b/src/Umbraco.Web/Media/ImageUrl.cs @@ -48,7 +48,7 @@ namespace Umbraco.Web.Media else { var p = UmbracoContext.Current.ContentCache.GetById(nodeId.GetValueOrDefault()); - var v = p.GetPropertyValue(field); + var v = p.Value(field); fieldValue = v == null ? string.Empty : v.ToString(); } } diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 806f899c21..cfd0589e05 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -118,7 +118,7 @@ namespace Umbraco.Web #endregion - #region GetPropertyValue + #region Value /// /// Recursively gets the value of a content's property identified by its alias. @@ -134,7 +134,7 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static object GetPropertyValue(this IPublishedContent content, string alias, bool recurse) + public static object Value(this IPublishedContent content, string alias, bool recurse) { var property = content.GetProperty(alias, recurse); return property?.Value; @@ -155,7 +155,7 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static object GetPropertyValue(this IPublishedContent content, string alias, bool recurse, object defaultValue) + public static object Value(this IPublishedContent content, string alias, bool recurse, object defaultValue) { var property = content.GetProperty(alias, recurse); return property == null || property.HasValue == false ? defaultValue : property.Value; @@ -163,7 +163,7 @@ namespace Umbraco.Web #endregion - #region GetPropertyValue + #region Value /// /// Recursively gets the value of a content's property identified by its alias, converted to a specified type. @@ -180,9 +180,9 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static T GetPropertyValue(this IPublishedContent content, string alias, bool recurse) + public static T Value(this IPublishedContent content, string alias, bool recurse) { - return content.GetPropertyValue(alias, recurse, false, default(T)); + return content.Value(alias, recurse, false, default(T)); } /// @@ -201,17 +201,17 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static T GetPropertyValue(this IPublishedContent content, string alias, bool recurse, T defaultValue) + public static T Value(this IPublishedContent content, string alias, bool recurse, T defaultValue) { - return content.GetPropertyValue(alias, recurse, true, defaultValue); + return content.Value(alias, recurse, true, defaultValue); } - internal static T GetPropertyValue(this IPublishedContent content, string alias, bool recurse, bool withDefaultValue, T defaultValue) + internal static T Value(this IPublishedContent content, string alias, bool recurse, bool withDefaultValue, T defaultValue) { var property = content.GetProperty(alias, recurse); if (property == null) return defaultValue; - return property.GetValue(withDefaultValue, defaultValue); + return property.Value(withDefaultValue, defaultValue); } #endregion @@ -283,7 +283,7 @@ namespace Umbraco.Web // rely on the property converter - will return default bool value, ie false, if property // is not defined, or has no value, else will return its value. - return content.GetPropertyValue(Constants.Conventions.Content.NaviHide) == false; + return content.Value(Constants.Conventions.Content.NaviHide) == false; } /// diff --git a/src/Umbraco.Web/PublishedContentPropertyExtension.cs b/src/Umbraco.Web/PublishedContentPropertyExtension.cs index dd36214167..2575bcde04 100644 --- a/src/Umbraco.Web/PublishedContentPropertyExtension.cs +++ b/src/Umbraco.Web/PublishedContentPropertyExtension.cs @@ -10,19 +10,19 @@ namespace Umbraco.Web /// public static class PublishedPropertyExtension { - #region GetValue + #region Value - public static T GetValue(this IPublishedProperty property) + public static T Value(this IPublishedProperty property) { - return property.GetValue(false, default(T)); + return property.Value(false, default(T)); } - public static T GetValue(this IPublishedProperty property, T defaultValue) + public static T Value(this IPublishedProperty property, T defaultValue) { - return property.GetValue(true, defaultValue); + return property.Value(true, defaultValue); } - internal static T GetValue(this IPublishedProperty property, bool withDefaultValue, T defaultValue) + internal static T Value(this IPublishedProperty property, bool withDefaultValue, T defaultValue) { if (property.HasValue == false && withDefaultValue) return defaultValue; diff --git a/src/Umbraco.Web/PublishedFragmentExtensions.cs b/src/Umbraco.Web/PublishedFragmentExtensions.cs index cb2c2a4619..5efad7cf18 100644 --- a/src/Umbraco.Web/PublishedFragmentExtensions.cs +++ b/src/Umbraco.Web/PublishedFragmentExtensions.cs @@ -75,7 +75,7 @@ namespace Umbraco.Web #endregion - #region GetPropertyValue + #region Value /// /// Gets the value of a content's property identified by its alias. @@ -89,7 +89,7 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static object GetPropertyValue(this IPublishedFragment content, string alias) + public static object Value(this IPublishedFragment content, string alias) { var property = content.GetProperty(alias); return property?.Value; @@ -108,7 +108,7 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static object GetPropertyValue(this IPublishedFragment content, string alias, string defaultValue) + public static object Value(this IPublishedFragment content, string alias, string defaultValue) { var property = content.GetProperty(alias); return property == null || property.HasValue == false ? defaultValue : property.Value; @@ -127,7 +127,7 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static object GetPropertyValue(this IPublishedFragment content, string alias, object defaultValue) + public static object Value(this IPublishedFragment content, string alias, object defaultValue) { var property = content.GetProperty(alias); return property == null || property.HasValue == false ? defaultValue : property.Value; @@ -135,7 +135,7 @@ namespace Umbraco.Web #endregion - #region GetPropertyValue + #region Value /// /// Gets the value of a content's property identified by its alias, converted to a specified type. @@ -150,9 +150,9 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static T GetPropertyValue(this IPublishedFragment content, string alias) + public static T Value(this IPublishedFragment content, string alias) { - return content.GetPropertyValue(alias, false, default(T)); + return content.Value(alias, false, default(T)); } /// @@ -169,21 +169,39 @@ namespace Umbraco.Web /// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter. /// The alias is case-insensitive. /// - public static T GetPropertyValue(this IPublishedFragment content, string alias, T defaultValue) + public static T Value(this IPublishedFragment content, string alias, T defaultValue) { - return content.GetPropertyValue(alias, true, defaultValue); + return content.Value(alias, true, defaultValue); } - internal static T GetPropertyValue(this IPublishedFragment content, string alias, bool withDefaultValue, T defaultValue) + internal static T Value(this IPublishedFragment content, string alias, bool withDefaultValue, T defaultValue) { var property = content.GetProperty(alias); if (property == null) return defaultValue; - return property.GetValue(withDefaultValue, defaultValue); + return property.Value(withDefaultValue, defaultValue); } #endregion + #region Value + + // trying to reproduce Umbraco.Field so we can get rid of it + // + // what we want: + // - alt aliases + // - recursion + // - default value + // - before & after (if value) + // + // convertLineBreaks: should be an extension string.ConvertLineBreaks() + // stripParagraphs: should be an extension string.StripParagraphs() + // format: should use the standard .ToString(format) + // + // see UmbracoComponentRenderer.Field - which is ugly ;-( + + #endregion + #region ToIndexedArray public static IndexedArrayItem[] ToIndexedArray(this IEnumerable source) diff --git a/src/Umbraco.Web/Routing/AliasUrlProvider.cs b/src/Umbraco.Web/Routing/AliasUrlProvider.cs index d78d9e6046..e9c737330e 100644 --- a/src/Umbraco.Web/Routing/AliasUrlProvider.cs +++ b/src/Umbraco.Web/Routing/AliasUrlProvider.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Routing var node = umbracoContext.ContentCache.GetById(id); string umbracoUrlName = null; if (node.HasProperty(Constants.Conventions.Content.UrlAlias)) - umbracoUrlName = node.GetPropertyValue(Constants.Conventions.Content.UrlAlias); + umbracoUrlName = node.Value(Constants.Conventions.Content.UrlAlias); if (string.IsNullOrWhiteSpace(umbracoUrlName)) return Enumerable.Empty(); diff --git a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs index f06d55c827..d002a8a1ec 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs @@ -485,7 +485,7 @@ namespace Umbraco.Web.Routing throw new InvalidOperationException("There is no PublishedContent."); var redirect = false; - var internalRedirect = _pcr.PublishedContent.GetPropertyValue(Constants.Conventions.Content.InternalRedirectId); + var internalRedirect = _pcr.PublishedContent.Value(Constants.Conventions.Content.InternalRedirectId); if (string.IsNullOrWhiteSpace(internalRedirect)) return false; @@ -685,7 +685,7 @@ namespace Umbraco.Web.Routing { if (_pcr.HasPublishedContent == false) return; - var redirectId = _pcr.PublishedContent.GetPropertyValue(Constants.Conventions.Content.Redirect, -1); + var redirectId = _pcr.PublishedContent.Value(Constants.Conventions.Content.Redirect, -1); var redirectUrl = "#"; if (redirectId > 0) redirectUrl = _routingContext.UrlProvider.GetUrl(redirectId); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 7fe0c6330f..60ad9360f5 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -171,6 +171,7 @@ + diff --git a/src/Umbraco.Web/UmbracoComponentRenderer.cs b/src/Umbraco.Web/UmbracoComponentRenderer.cs index c07930090e..08f938067f 100644 --- a/src/Umbraco.Web/UmbracoComponentRenderer.cs +++ b/src/Umbraco.Web/UmbracoComponentRenderer.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web /// /// Used by UmbracoHelper /// - internal class UmbracoComponentRenderer : IUmbracoComponentRenderer + internal class UmbracoComponentRenderer : IUmbracoComponentRendererWithField { private readonly UmbracoContext _umbracoContext; diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index ee8c7eb28c..8ac22da688 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -241,75 +241,6 @@ namespace Umbraco.Web #endregion - #region Field - - /// - /// Renders an field to the template - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - //// - /// - public IHtmlString Field(string fieldAlias, - string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", - bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, - RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, - RenderFieldEncodingType encoding = RenderFieldEncodingType.Unchanged, - bool formatAsDate = false, - bool formatAsDateWithTime = false, - string formatAsDateWithTimeSeparator = "") - { - return UmbracoComponentRenderer.Field(AssignedContentItem, fieldAlias, altFieldAlias, - altText, insertBefore, insertAfter, recursive, convertLineBreaks, removeParagraphTags, - casing, encoding, formatAsDate, formatAsDateWithTime, formatAsDateWithTimeSeparator); - } - - /// - /// Renders an field to the template - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - //// - /// - public IHtmlString Field(IPublishedContent currentPage, string fieldAlias, - string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", - bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, - RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, - RenderFieldEncodingType encoding = RenderFieldEncodingType.Unchanged, - bool formatAsDate = false, - bool formatAsDateWithTime = false, - string formatAsDateWithTimeSeparator = "") - { - return UmbracoComponentRenderer.Field(currentPage, fieldAlias, altFieldAlias, - altText, insertBefore, insertAfter, recursive, convertLineBreaks, removeParagraphTags, - casing, encoding, formatAsDate, formatAsDateWithTime, formatAsDateWithTimeSeparator); - } - - #endregion - #region Dictionary /// diff --git a/src/Umbraco.Web/umbraco.presentation/item.cs b/src/Umbraco.Web/umbraco.presentation/item.cs index 7ce8f0f2dc..193b0a7c27 100644 --- a/src/Umbraco.Web/umbraco.presentation/item.cs +++ b/src/Umbraco.Web/umbraco.presentation/item.cs @@ -74,7 +74,7 @@ namespace umbraco //check for published content and get its value using that if (publishedContent != null && (publishedContent.HasProperty(_fieldName) || recursive)) { - var pval = publishedContent.GetPropertyValue(_fieldName, recursive); + var pval = publishedContent.Value(_fieldName, recursive); var rval = pval == null ? string.Empty : pval.ToString(); _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval; } @@ -94,7 +94,7 @@ namespace umbraco { if (publishedContent != null && (publishedContent.HasProperty(altFieldName) || recursive)) { - var pval = publishedContent.GetPropertyValue(altFieldName, recursive); + var pval = publishedContent.Value(altFieldName, recursive); var rval = pval == null ? string.Empty : pval.ToString(); _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval; }