本文整理汇总了C#中IPublishedContent.HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.HasProperty方法的具体用法?C# IPublishedContent.HasProperty怎么用?C# IPublishedContent.HasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPublishedContent
的用法示例。
在下文中一共展示了IPublishedContent.HasProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetThemePath
/// <summary>
/// Gets the path to the currently assigned theme.
/// </summary>
/// <param name="model">
/// The <see cref="IMasterModel"/>.
/// </param>
/// <returns>
/// The <see cref="string"/> representing the path to the starter kit theme folder.
/// </returns>
public static string GetThemePath(IPublishedContent model)
{
const string Path = "~/App_Plugins/Merchello.Bazaar/Themes/{0}/";
return model.HasProperty("theme") && model.HasValue("theme") ?
string.Format(Path, model.GetPropertyValue<string>("theme")) :
string.Empty;
}
示例2: TitleTag
public static string TitleTag(IPublishedContent currentPage)
{
if (currentPage.HasProperty(Up.Mixins.Seo.TitleTag) && currentPage.HasValue(Up.Mixins.Seo.TitleTag)) { return currentPage.GetPropertyValue<string>(Up.Mixins.Seo.TitleTag); }
if (currentPage.Level > 1) { return currentPage.Name; }
return Settings.DefaultTitleTag;
}
示例3: OGImage
public static string OGImage(IPublishedContent currentPage)
{
if (currentPage.HasProperty(Up.Mixins.Seo.OgImage) && currentPage.HasValue(Up.Mixins.Seo.OgImage))
{
return @"<meta property=""og:image"" content=""" + Settings.BaseUrlWithoutSlash + new UmbracoHelper(UmbracoContext.Current).TypedMedia(currentPage.GetPropertyValue<int>(Up.Mixins.Seo.OgImage)).GetCropUrl(CropSize.OGImage_1200_x_630) + @""">";
}
return "";
}
示例4: GetObjectByNode
public static CanvasModel GetObjectByNode(IPublishedContent node)
{
try
{
var model = new CanvasModel();
if (node.HasProperty("canvas") && node.HasValue("canvas"))
{
string json = node.GetPropertyValue<string>("canvas");
model = JsonConvert.DeserializeObject<CanvasModel>(json);
}
return model;
}
catch (Exception ex)
{
Log.Error("Canvas error on GetObjectByNode in Repository.", ex);
return null;
}
}
示例5: ConvertToItem
private ItemPreview ConvertToItem(IPublishedContent result)
{
var item = new ItemPreview();
item.NodeId = result.Id;
item.NodeTypeAlias = result.DocumentTypeAlias;
item.ParentName = result.Parent.Name;
item.ParentUrl = result.Parent.Url;
item.Url = result.Url;
if (result.HasProperty("contentTitle") && result.HasValue("contentTitle"))
{
item.Title = result.GetPropertyValue<string>("contentTitle");
}
if (result.HasProperty("contentSubtitle") && result.HasValue("contentSubtitle"))
{
item.Subtitle = result.GetPropertyValue<string>("contentSubtitle");
}
if (result.HasProperty("contentDescription") && result.HasValue("contentDescription"))
{
item.Description = result.GetPropertyValue<string>("contentDescription");
}
if (result.HasProperty("contentThumbnail") && result.HasValue("contentThumbnail"))
{
item.ThumbnailImageUrl = umbracoHelper.TypedMedia(result.GetPropertyValue("contentThumbnail")).Url;
}
if (result.HasProperty("contentThumbnailVideo") && result.HasValue("contentThumbnailVideo"))
{
item.ThumnailVideoUrl = result.GetPropertyValue<string>("contentThumbnailVideo");
}
if (result.HasProperty("contentDate") && result.HasValue("contentDate"))
{
item.Date = result.GetPropertyValue<DateTime>("contentDate");
item.DateFormatted = item.Date.ToString("dd MMMMMMMMM, yyyy", CultureInfo.GetCultureInfoByIetfLanguageTag("pt"));
}
return item;
}
示例6: GetSelectedUsers
/// <summary>
/// Gets selected users list from Multi User Select type field
/// </summary>
/// <param name="node"></param>
/// <param name="propertyAlias"></param>
/// <returns></returns>
public static IEnumerable<User> GetSelectedUsers(IPublishedContent node, String propertyAlias)
{
List<User> selectedUsers = new List<User>();
if (node != null && !String.IsNullOrEmpty(propertyAlias) && node.HasProperty(propertyAlias) && node.HasValue(propertyAlias))
{
var userIds = node.GetPropertyValue<String>(propertyAlias).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var selectedUserId in userIds)
{
User user = User.GetUser(Int32.Parse(selectedUserId));
if (user != null)
{
selectedUsers.Add(user);
}
}
}
return selectedUsers;
}
示例7: HasSortingConfiguration
static bool HasSortingConfiguration(IPublishedContent node)
{
return node != null && node.HasProperty("sortBy") && node.HasProperty("sortOrderNew");
}
示例8: OGTitle
public static string OGTitle(IPublishedContent currentPage)
{
if (currentPage.HasProperty(Up.Mixins.Seo.OgTitle) && currentPage.HasValue(Up.Mixins.Seo.OgTitle)) { return currentPage.GetPropertyValue<string>(Up.Mixins.Seo.OgTitle); }
return TitleTag(currentPage);
}
示例9: OGDescription
public static string OGDescription(IPublishedContent currentPage)
{
if (currentPage.HasProperty(Up.Mixins.Seo.OgDescription) && currentPage.HasValue(Up.Mixins.Seo.OgDescription)) { return currentPage.GetPropertyValue<string>(Up.Mixins.Seo.OgDescription); }
return MetaDescription(currentPage);
}
示例10: GetPickedGroups
/// <summary>
/// Gets the list of personalisation group content items associated with the current content item
/// </summary>
/// <param name="content">Instance of IPublished content</param>
/// <returns>List of personalisation group content items</returns>
private static IList<IPublishedContent> GetPickedGroups(IPublishedContent content)
{
var propertyAlias = GetGroupPickerAlias();
if (content.HasProperty(propertyAlias))
{
var propertyValue = content.GetProperty(propertyAlias).DataValue.ToString();
if (!string.IsNullOrEmpty(propertyValue))
{
var pickedGroupIds = propertyValue
.Split(',')
.Select(x => int.Parse(x));
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
return umbracoHelper.TypedContent(pickedGroupIds).ToList();
}
}
return new List<IPublishedContent>();
}