/// <summary> /// Initializes a new instance of ContentEditorField class. /// </summary> /// <param name="form">The form object.</param> /// <param name="field">The content field.</param> public ContentEditorField(ContentFormDecorator form, ContentField field) { this.ParentForm = form; this.Parent = form.Parent; field.CopyTo(this, "Parent"); Template = new ContentTemplate(); switch ((ContentFormTypes)form.FormType) { case ContentFormTypes.Display: if (field.HasDisplayTemlpate) Template.Source = field.DisplayTemplate; break; case ContentFormTypes.Activity: if (field.HasActivityTemplate) Template.Source = field.ActivityTemplate; break; case ContentFormTypes.Edit: if (field.HasEditTemlpate) Template.Source = field.EditTemplate; break; case ContentFormTypes.New: if (field.HasNewTemlpate) Template.Source = field.NewTemplate; break; } }
/// <summary> /// Initializes a new instance of the ContentFieldRef class. /// </summary> /// <param name="parent">The parent view object.</param> /// <param name="field">The content field.</param> public ContentFieldRef(ContentViewDecorator parent, ContentField field) { this.ParentView = parent; this.Parent = parent.Parent; field.CopyTo(this, "Parent"); isFilterable = field.IsFilterable; this.Field = field; Template = new ContentTemplate(); if (field.HasViewTemplate) Template.Source = field.ViewTemplate; }
private string SerializeField(ContentField field) { ContentFieldTypes t = (ContentFieldTypes)field.FieldType; return JsonConvert.SerializeObject( new { name = field.Name, title = field.Title, required = field.IsRequired, type = t.ToString() }); }
private VueComponentDefinition[] GetColumnCellValue(ContentField field, ContentFieldDefinition definition) { var f = field.DirectCastTo <BooleanField>(); var fcfg = definition.Config.DirectCastTo <BooleanFieldConfiguration>(); if (!f.Val.HasValue) { return(new VueComponentDefinition[] { new VueHtmlWidget($"<i class='fa fa-question-circle'></i> {fcfg.NullBoolLabel ?? "Unknown"}") }); } if (f.Val.Value) { return(new VueComponentDefinition[] { new VueHtmlWidget($"<i class='fa fa-check-square'></i> {fcfg.TrueBoolLabel ?? "Yes"}") }); } return(new VueComponentDefinition[] { new VueHtmlWidget($"<i class='fa fa-square-o'></i> {fcfg.FalseBoolLabel ?? "Yes"}") }); }
private string SummarizedValue(ContentField contentField, ContentFieldDefinition contentFieldDefinition) { var field = contentField.DirectCastTo <SelectField>(); var fcfg = contentFieldDefinition.Config.DirectCastTo <SelectFieldConfiguration>(); var handler = fcfg.OptionsHandler(); if (!fcfg.IsMultiSelect) { var val = field.Val.FirstOrDefault(); var sumval = "-n/a-"; if (val != null) { var opt = handler.GetOptionObject(val, fcfg.OptionsHandlerParam); if (opt != null) { sumval = $"{handler.GetOptionDisplay(opt, fcfg.OptionsHandlerParam).Label}"; } } return(sumval); } return($"{field.Val.Length} items in {fcfg.Label} field"); }
protected override void Initialize(out ContentField field) { field = new ContentField(ContentFieldConstants.Minus) { Right = new ContentField(ContentFieldConstants.Minus) { Right = new ContentField(ContentFieldConstants.Minus) { BottomLeft = new ContentField(ContentFieldConstants.Angular1) { Bottom = new ContentField(ContentFieldConstants.Angular2) { Bottom = new ContentField(ContentFieldConstants.Minus) { Left = new ContentField(ContentFieldConstants.Minus) } } } } } }; }
public override object GetValue(ContentItem contentItem, ContentField field) { var value = field.Storage.Get <int?>(null); if (value == null) { return(null); } var referenceContentItem = _contentManager.Get(value.Value); var contentItemMetadata = _contentManager.GetItemMetadata(referenceContentItem); var pluralService = PluralizationService.CreateService(new CultureInfo("en-US")); string pluralContentTypeName = pluralService.Pluralize(referenceContentItem.ContentType); var linkTag = new TagBuilder("a"); linkTag.AddCssClass("btn-link"); linkTag.Attributes.Add("ui-sref", "View({NavigationId: $stateParams.NavigationId, Module: '" + pluralContentTypeName + "', Id: " + value + "})"); linkTag.InnerHtml = contentItemMetadata.DisplayText; return(linkTag.ToString()); }
private ResourceType GetOrCreateContentField(ContentField contentField) { var contentFieldName = contentField.Name; if (this._resourceTypes.ContainsKey(contentFieldName)) { return(this._resourceTypes[contentFieldName]); } var contentFieldType = contentField.GetType(); var resourceTypeContentField = new ResourceType( contentFieldType, ResourceTypeKind.ComplexType, null, (this as IDataServiceMetadataProvider).ContainerNamespace, contentFieldName, false); resourceTypeContentField.CanReflectOnInstanceType = false; resourceTypeContentField.AddResourcePropertiesFromInstanceType(contentFieldType); contentFieldType .GetProperties() .Where(property => property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(IEnumerable <>)) .ToList() .ForEach(property => { var orchardType = property.PropertyType.GenericTypeArguments.Single(); if (orchardType.BaseType.IsGenericType && orchardType.BaseType.GetGenericTypeDefinition() == typeof(ContentPart <>)) { var resourceType = this.GetOrCreateContentPart(orchardType, orchardType.Name); resourceType.CustomState = property; resourceTypeContentField.AddResourcePropertyFromInstanceCollectionResourceType(resourceType); } }); this._resourceTypes[contentFieldName] = resourceTypeContentField; return(resourceTypeContentField); }
/// <summary> /// Initializes a new instance of ContentEditorField class. /// </summary> /// <param name="form">The form object.</param> /// <param name="field">The content field.</param> public ContentEditorField(ContentFormDecorator form, ContentField field) { this.ParentForm = form; this.Parent = form.Parent; field.CopyTo(this, "Parent"); Template = new ContentTemplate(); switch ((ContentFormTypes)form.FormType) { case ContentFormTypes.Display: if (field.HasDisplayTemlpate) { Template.Source = field.DisplayTemplate; } break; case ContentFormTypes.Activity: if (field.HasActivityTemplate) { Template.Source = field.ActivityTemplate; } break; case ContentFormTypes.Edit: if (field.HasEditTemlpate) { Template.Source = field.EditTemplate; } break; case ContentFormTypes.New: if (field.HasNewTemlpate) { Template.Source = field.NewTemplate; } break; } }
public void PerformModification(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { var pfn = $"{fieldDefinition.FieldName}.{nameof(PublishingField.PublishedUtc)}"; var ufn = $"{fieldDefinition.FieldName}.{nameof(PublishingField.UnpublishedUtc)}"; var fp = modifierForm.DirectCastTo <PublishingFieldModifierForm>(); var publishedUtc = fp?.PublishedAt?.ToUniversalTime(); var pcf = content.ContentFields.FirstOrDefault(x => x.FieldName == pfn); if (pcf == null) { pcf = new ProtoField { FieldName = pfn, ContentId = content.Id }; content.ContentFields.Add(pcf); } pcf.FieldClassTypeName = typeof(PublishingField).FullName; pcf.DateTimeValue = publishedUtc; var unpublishedUtc = fp?.UnpublishedAt?.ToUniversalTime(); var ucf = content.ContentFields.FirstOrDefault(x => x.FieldName == ufn); if (ucf == null) { ucf = new ProtoField { FieldName = ufn, ContentId = content.Id }; content.ContentFields.Add(ucf); } ucf.FieldClassTypeName = typeof(PublishingField).FullName; ucf.DateTimeValue = unpublishedUtc; }
public VisualItem VisualItemFactory(ScreenContent ScreenContent, ContentField contentField) { VisualItem visualItem = null; if (contentField is ContinuedContentField) { var contField = contentField as ContinuedContentField; if (contField.ContinuedFieldSegmentCode == ContinuedFieldSegmentCode.First) { visualItem = new VisualSpanner(ScreenContent, contField, this.CanvasDefn); } } else { visualItem = this.VisualItemFactory( contentField.GetShowText(ScreenContent), contentField.RowCol, contentField.GetAttrByte(ScreenContent), contentField.GetTailAttrByte(ScreenContent)); } return(visualItem); }
public void NullCheckingCanBeDoneOnProperties() { var contentItem = new ContentItem(); var contentPart = new ContentPart { TypePartDefinition = new ContentTypePartDefinition(new ContentPartDefinition("FooPart"), new SettingsDictionary()) }; var contentField = new ContentField { PartFieldDefinition = new ContentPartFieldDefinition(new ContentFieldDefinition("FooType"), "FooField", new SettingsDictionary()) }; dynamic item = contentItem; dynamic part = contentPart; Assert.That(item.FooPart == null, Is.True); Assert.That(item.FooPart != null, Is.False); contentItem.Weld(contentPart); Assert.That(item.FooPart == null, Is.False); Assert.That(item.FooPart != null, Is.True); Assert.That(item.FooPart, Is.SameAs(contentPart)); Assert.That(part.FooField == null, Is.True); Assert.That(part.FooField != null, Is.False); Assert.That(item.FooPart.FooField == null, Is.True); Assert.That(item.FooPart.FooField != null, Is.False); contentPart.Weld(contentField); Assert.That(part.FooField == null, Is.False); Assert.That(part.FooField != null, Is.True); Assert.That(item.FooPart.FooField == null, Is.False); Assert.That(item.FooPart.FooField != null, Is.True); Assert.That(part.FooField, Is.SameAs(contentField)); Assert.That(item.FooPart.FooField, Is.SameAs(contentField)); }
private string GetAgileUploaderMediaFolder(IContent part, ContentField field, AgileUploaderFieldSettings settings) { var agileUploaderMediaFolder = settings.MediaFolder; if (String.IsNullOrWhiteSpace(agileUploaderMediaFolder)) { agileUploaderMediaFolder = TokenContentType + "/" + TokenFieldName; } agileUploaderMediaFolder = agileUploaderMediaFolder .Replace(TokenContentType, part.ContentItem.ContentType) .Replace(TokenFieldName, field.Name) .Replace(TokenContentItemId, Convert.ToString(part.ContentItem.Id)); if (!string.IsNullOrEmpty(TokenUserId)) { var idUser = "******"; if (_orchardServices.WorkContext.CurrentUser != null) { idUser = Convert.ToString(_orchardServices.WorkContext.CurrentUser.Id); } agileUploaderMediaFolder = agileUploaderMediaFolder.Replace(TokenUserId, idUser); } return(agileUploaderMediaFolder); }
public VueComponentDefinition[] ConvertFormToVues(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { var vues = new List <VueComponentDefinition> { new VueComponentDefinition { Name = "cms-form-field-datetime", Props = new { label = "Published At", valuePath = nameof(PublishingFieldModifierForm.PublishedAt) } }, new VueComponentDefinition { Name = "cms-form-field-datetime", Props = new { label = "Unpublished At", valuePath = nameof(PublishingFieldModifierForm.UnpublishedAt) } } }; return(vues.ToArray()); }
public void PerformModification(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { if (operation.Is(CommonFieldModifyOperationsProvider.CREATE_OPERATION_NAME)) { content.CreatedUtc = DateTime.UtcNow; content.UpdatedUtc = content.CreatedUtc; _dbContext.ProtoContents.Add(content); } else if (operation.Is(CommonFieldModifyOperationsProvider.DELETE_OPERATION_NAME)) { content.UpdatedUtc = DateTime.UtcNow; _dbContext.ProtoContents.Remove(content); } else { content.UpdatedUtc = DateTime.UtcNow; } if (string.IsNullOrWhiteSpace(content.CreatedByUserId)) { var rctx = ProtoCmsRuntimeContext.Current; if (rctx.CurrentUser != null) { content.CreatedByUserId = rctx.CurrentUser.Id; } } var creator = _userMgr.ProtoUsers.FirstOrDefault(x => x.Id == content.CreatedByUserId); if (creator != null) { content.CreatedByUserName = creator.UserName; content.CreatedByUserDisplayName = creator.DisplayName; } _dbContext.ThisDbContext().SaveChanges(); }
public CaptureScope Node(ContentField field) { return(Node(field.Name)); }
public VueComponentDefinition[] ConvertFormToVues(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { var cfg = fieldDefinition.Config.DirectCastTo <TextFieldConfiguration>(); var editorVue = new VueComponentDefinition { Name = "cms-form-field-text", Props = new { label = cfg.Label, helpText = cfg.HelpText, valuePath = nameof(TextFieldModifierForm.Val) } }; switch (cfg.EditorType) { case TextFieldEditorType.TextArea: editorVue = new VueComponentDefinition { Name = "cms-form-field-textarea", Props = new { label = cfg.Label, helpText = cfg.HelpText, valuePath = nameof(TextFieldModifierForm.Val) } }; break; case TextFieldEditorType.RichHtml: editorVue = new VueComponentDefinition { Name = "cms-form-field-rich-html", Props = new { label = cfg.Label, helpText = cfg.HelpText, valuePath = nameof(TextFieldModifierForm.Val) } }; break; } return(new[] { editorVue }); }
public override void Displaying(ShapeDisplayingContext context) { context.ShapeMetadata .OnDisplaying(displayedContext => { if (displayedContext.ShapeMetadata.Type == "Zone") { // we'll use this to have alternates for specific zones lastZone = displayedContext.Shape.ZoneName; // this adds alternates to personalize the entire zone for a specific // ContentItem being displayed var currentCI = _currentContentAccessor.CurrentContentItem; if (currentCI != null) { AddPersonalizedAlternates(displayedContext, currentCI, false); } } else if (displayedContext.Shape.ContentItem is ContentItem) { // The item we are displaying ContentItem contentItem = displayedContext.Shape.ContentItem; // The part and field we are displaying, if any ContentPart contentPart = displayedContext.Shape.ContentPart is ContentPart ? displayedContext.Shape.ContentPart : null; ContentField contentField = displayedContext.Shape.ContentField is ContentField ? displayedContext.Shape.ContentField : null; // Other elements we can use to personalize the alternate name var displayType = displayedContext.ShapeMetadata.DisplayType; var shapeName = displayedContext.ShapeMetadata.Type; var zoneName = lastZone; // delegate that will add the alternates to the list of usable ones Action <string> AddAlternate = (s) => AddAlternateName(displayedContext.ShapeMetadata.Alternates, s); // Add some alternates for ProjectionPart if (contentPart.Is <ProjectionPart>() && contentPart.PartDefinition.Name == "ProjectionPart") { var suffix = ""; if (displayedContext.ShapeMetadata.Type == "List" && displayedContext.Shape.PagerId != null) // è una lista ma all'interno c'è il pager { suffix = "__Pager"; AddAlternate(shapeName + "__" + contentItem.ContentType + suffix); } if (contentPart.As <ProjectionPart>().Record.QueryPartRecord != null) { var queryName = _queryService.GetQuery(contentPart.As <ProjectionPart>().Record.QueryPartRecord.Id).Name; queryName = queryName.Normalize(System.Text.NormalizationForm.FormD).ToLower().Replace(" ", ""); AddAlternate(shapeName + "__" + contentItem.ContentType + suffix + "__ForQuery__" + queryName); if (!String.IsNullOrWhiteSpace(zoneName)) { AddAlternate(shapeName + "__" + contentItem.ContentType + suffix + "__ForQuery__" + queryName + "__" + zoneName); } } } // The goal of the next few alternates is to enable very specific // alternates for a given ContentItem, that are "portable", meaning that we can // drop the cshtml on any environment we may have imported the content to and it // will just work, without renaming or such. An alternative that gets close is // to use and alternate based on the URL, but that suffers from cases where we // have tenants using the same theme (that contains the alternate) and with different // url prefixes. // Using IdentityPart or AutoroutePart should allow us to get around that. AddPersonalizedAlternates(displayedContext, contentItem); } else { // this adds alternates for other shapes in the page, that don't belong // directly to the "main" content being displayed. For example, the menu // in the AsideSecond when a given content is displayed. var currentCI = _currentContentAccessor.CurrentContentItem; if (currentCI != null) { AddPersonalizedAlternates(displayedContext, currentCI); } } }); }
public VueComponentDefinition[] ConvertFormToVues(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { var cfg = fieldDefinition.Config.DirectCastTo <SelectFieldConfiguration>(); return(new[] { new VueComponentDefinition { Name = "cms-form-field-select", Props = new { label = fieldDefinition.Config.Label ?? fieldDefinition.FieldName, valuePath = $"{nameof(SelectField.Val)}", isMultiSelect = cfg.IsMultiSelect, optionsHandlerId = cfg.OptionsHandlerId, optionsHandlerParam = cfg.OptionsHandlerParam } }, }); }
public void EditContent() { ContentField.SendKeys("This should not be visible"); }
/// <summary> /// Render html element for specified field object. /// </summary> /// <param name="html">The html helper object.</param> /// <param name="field">The field object</param> /// <returns></returns> public static HelperResult Label(this HtmlHelper html, ContentField field) { return new HelperResult((w) => { using (var writer = new Html32TextWriter(w)) { try { writer.WriteBeginTag("label"); writer.WriteAttribute("for", field.ClientID); writer.Write(HtmlTextWriter.TagRightChar); if (!string.IsNullOrEmpty(field.Title)) writer.WriteEncodedText(field.Title); else writer.WriteEncodedText(field.Name); writer.WriteEndTag("label"); } catch { } } }); }
private JProperty SerializeField(ContentField field, int actualLevel, ContentItem item = null) { var fieldObject = new JObject(); if (field.FieldDefinition.Name == "EnumerationField") { var enumField = (EnumerationField)field; string[] selected = enumField.SelectedValues; string[] options = enumField.PartFieldDefinition.Settings["EnumerationFieldSettings.Options"].Split(new string[] { Environment.NewLine }, StringSplitOptions.None); fieldObject.Add("Options", JToken.FromObject(options)); fieldObject.Add("SelectedValues", JToken.FromObject(selected)); } else if (field.FieldDefinition.Name == "TaxonomyField") { SerializeTaxonomyField((TaxonomyField)field, actualLevel, ref fieldObject, item); } else if (field.FieldDefinition.Name == "NumericField") { var numericField = field as NumericField; object val = 0; if (numericField.Value.HasValue) { val = numericField.Value.Value; } FormatValue(ref val); return(new JProperty(field.Name + field.FieldDefinition.Name, val)); } else if (field.FieldDefinition.Name == "TextField") { var textField = field as TextField; object val = textField.Value; if (val != null) { if (textField.PartFieldDefinition.Settings.ContainsKey("TextFieldSettings.Flavor")) { var flavor = textField.PartFieldDefinition.Settings["TextFieldSettings.Flavor"]; // markdownFilter acts only if flavor is "markdown" val = _markdownFilter.ProcessContent(val.ToString(), flavor); } FormatValue(ref val); } return(new JProperty(field.Name + field.FieldDefinition.Name, val)); } else if (field.FieldDefinition.Name == "InputField") { var inputField = field as InputField; object val = inputField.Value; FormatValue(ref val); return(new JProperty(field.Name + field.FieldDefinition.Name, val)); } else if (field.FieldDefinition.Name == "BooleanField") { var booleanField = field as BooleanField; object val = false; if (booleanField.Value.HasValue) { val = booleanField.Value.Value; } FormatValue(ref val); return(new JProperty(field.Name + field.FieldDefinition.Name, val)); } else if (field.FieldDefinition.Name == "DateTimeField") { var dateTimeField = field as DateTimeField; object val = dateTimeField.DateTime; FormatValue(ref val); return(new JProperty(field.Name + field.FieldDefinition.Name, val)); } else { var properties = field.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(prop => !_skipFieldTypes.Contains(prop.Name) //skip ); foreach (var property in properties) { try { if (!_skipFieldProperties.Contains(property.Name)) { object val = property.GetValue(field, BindingFlags.GetProperty, null, null, null); if (val != null) { PopulateJObject(ref fieldObject, property, val, _skipFieldProperties, actualLevel); } } } catch { } } } return(new JProperty(field.Name + field.FieldDefinition.Name, fieldObject)); }
private void UpdateSinglePart(ContentItem ci, KeyValuePair <string, string> prop, ContentField cf) { // var cf = profile.Fields.Where(x => x.Name == prop.Key).FirstOrDefault(); if (cf != null) { if (cf.GetType() == typeof(DateTime)) { ((dynamic)cf).DateTime = prop.Value; } else if (cf.GetType() == typeof(TaxonomyField)) { UpdateTaxonomyField(ci, cf as TaxonomyField, prop.Value); } else if ((cf.GetType() == typeof(MediaLibraryPickerField)) || (cf.GetType() == typeof(ContentPickerField))) { Errors.Add(string.Format("Property {0} of type {1} cannot be updated by CSV import.", prop.Key, cf.GetType().Name)); } else { ((dynamic)cf).Value = prop.Value; } } else { Errors.Add(string.Format("Field \"{0}\" not found in Contact.", prop.Key)); } }
public VueComponentDefinition[] ConvertFormToVues(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { var fcfg = fieldDefinition.Config.DirectCastTo <FilePickerFieldConfiguration>(); return(new[] { new VueComponentDefinition { Name = "cms-form-field-file-picker", Props = new { label = fcfg.Label ?? fieldDefinition.FieldName, valuePath = nameof(FilePickerFieldModifierForm.Val), helpText = fcfg.HelpText, isMultiSelect = fcfg.IsMultiSelect, fileExplorerPageUrl = _urlProv.GenerateManageFileExplorerUrl() } } }); }
public static BsonValue ToBsonValue(this ContentField contentField) { IFieldSerializer fieldSerializer = MongoFieldManager.Default.GetByType(contentField.GetType()); return(fieldSerializer.Write(contentField)); }
public VueComponentDefinition[] ConvertFormToVues(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { var fcfg = fieldDefinition.Config.DirectCastTo <BooleanFieldConfiguration>(); return(new[] { new VueComponentDefinition { Name = "cms-form-field-checkbox", Props = new { label = fieldDefinition.Config.Label ?? fieldDefinition.FieldName, valuePath = nameof(BooleanFieldModifierForm.Val), yesLabel = fcfg.TrueBoolLabel, noLabel = fcfg.FalseBoolLabel, helpText = fcfg.HelpText, } } }); }
/// <summary> /// Render validation HTML elements for specified field object. /// </summary> /// <param name="html">The html helper object.</param> /// <param name="field">The field object.</param> /// <returns></returns> public static HelperResult ValidationMessage(this HtmlHelper html, ContentField field) { return new HelperResult((w) => { using (var writer = new Html32TextWriter(w)) { writer.WriteBeginTag("span"); writer.WriteAttribute("class", "d-field-val-msg d-valmsg"); writer.WriteAttribute("data-valmsg-for", field.Name); writer.WriteAttribute("data-valmsg-replace", "true"); writer.Write(HtmlTextWriter.TagRightChar); //writer.WriteEncodedText(field.Description); writer.WriteEndTag("span"); } }); }
private static string GetDifferentiator(ContentField field, ContentPart part) { return(field.Name); }
private static string GetPrefix(ContentField field, ContentPart part) { return(part.PartDefinition.Name + "." + field.Name); }
public CaptureScope List(ContentField field) { return(List(field.Name)); }
/// <summary> /// Render field description text for specified field object. /// </summary> /// <param name="html">The html helper object.</param> /// <param name="field">The field object.</param> /// <returns></returns> public static HelperResult Notes(this HtmlHelper html, ContentField field) { return new HelperResult((w) => { using (var writer = new Html32TextWriter(w)) { if (!string.IsNullOrEmpty(field.Description)) { writer.WriteBeginTag("small"); //writer.WriteAttribute("class", "d-field-notes d-notes"); writer.Write(HtmlTextWriter.TagRightChar); writer.WriteEncodedText(field.Description); writer.WriteEndTag("small"); } } }); }
private void RemoveQuestionsFromField(ContentItem ci, ContentField field) { field.Storage = null; // ((dynamic)field).Ids = new int[] { }; }
/// <summary> /// Render hidden input element for field value. /// </summary> /// <param name="html">The html helper object.</param> /// <param name="field">The field object</param> /// <param name="value">the field value</param> /// <returns></returns> public static HelperResult Hidden(this HtmlHelper html, ContentField field, object value = null) { return new HelperResult((w) => { using (var writer = new Html32TextWriter(w)) { writer.WriteBeginTag("input"); writer.WriteAttribute("type", "hidden"); writer.WriteAttribute("id", field.ClientID); writer.WriteAttribute("name", field.Name); if (value != null) { writer.WriteAttribute("value", value.ToString()); } else { if (field.DefaultValue != null) writer.WriteAttribute("value", field.DefaultValue.ToString()); } writer.Write(HtmlTextWriter.SelfClosingTagEnd); } }); }
public void PerformModification(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { }
public ContentModifierForm BuildModifierForm(ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { return(null); }
private static string GetPrefix(ContentField field, ContentPart part) { // handles spaces in field names return((part.PartDefinition.Name + "." + field.Name) .Replace(" ", "_")); }
public VueComponentDefinition[] ConvertFormToVues(ContentModifierForm modifierForm, ContentField field, ContentModifyOperation operation, ProtoContent content, ContentFieldDefinition fieldDefinition) { return(null); }