/// <summary> /// Create a help-table showing all the tokens/placeholders for a specific content type /// </summary> /// <param name="contentTypeId"></param> /// <param name="FormatString"></param> /// <param name="TemplateDefault"></param> /// <param name="LanguageList"></param> private void AddHelpForAContentType(int contentTypeId, string FormatString, TemplateDefault TemplateDefault, int[] LanguageList) { Eav.AttributeSet Set = Sexy.ContentContext.GetAttributeSet(contentTypeId); var DataSource = Sexy.ContentContext.GetAttributes(Set, true).Select(a => new { StaticName = String.Format(FormatString, TemplateDefault.ItemType.ToString("F"), a.StaticName), DisplayName = (Sexy.ContentContext.GetAttributeMetaData(a.AttributesInSets.FirstOrDefault().AttributeID)).ContainsKey("Name") ? (Sexy.ContentContext.GetAttributeMetaData(a.AttributesInSets.FirstOrDefault().AttributeID))["Name"][LanguageList] : a.StaticName + " (static)" }).ToList(); AddFieldGrid(DataSource, TemplateDefault.ItemType.ToString("F")); }
public static void AppendAttributeValues(this Entity entity, Eav.AttributeSet attributeSet, Dictionary <string, object> values, string valuesLanguage, bool valuesReadOnly, bool resolveHyperlink) { foreach (var value in values) { // Handle special attributes (for example of the system) if (value.Key == "IsPublished") { entity.IsPublished = value.Value is bool?(bool)value.Value : true; continue; } // Handle content-type attributes var attribute = attributeSet.GetAttribute(value.Key); if (attribute == null) { throw new ArgumentException("Attribute '" + attribute + "' does not exist."); } entity.AppendAttributeValue(value.Key, value.Value.ToString(), attribute.Type, valuesLanguage, valuesReadOnly, resolveHyperlink); } }