public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate( ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) { if (builder.FieldType == "HiddenStringField") { var model = new HiddenStringFieldSettingsEventsViewModel { Settings = new HiddenStringFieldSettings(), ProcessVariant = HiddenStringFieldUpdateProcessVariant.None, ProcessVariants = _updateProcessor.GetVariants() }; if (updateModel.TryUpdateModel(model, "HiddenStringFieldSettingsEventsViewModel", null, null)) { builder.WithSetting("HiddenStringFieldSettings.Tokenized", model.Settings.Tokenized.ToString()); builder.WithSetting("HiddenStringFieldSettings.TemplateString", model.Settings.TemplateString); _updateProcessor.AddTask(model.ProcessVariant, model.Settings, builder); model.ProcessVariant = HiddenStringFieldUpdateProcessVariant.None; yield return(DefinitionTemplate(model)); } } else { yield break; } }
public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate( ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) { if (builder.FieldType == "HiddenStringField") { var model = new HiddenStringFieldSettingsEventsViewModel { Settings = new HiddenStringFieldSettings(), ProcessVariant = HiddenStringFieldUpdateProcessVariant.None, ProcessVariants = GetVariants() }; if (updateModel.TryUpdateModel(model, "HiddenStringFieldSettingsEventsViewModel", null, null)) { builder.WithSetting("HiddenStringFieldSettings.Tokenized", model.Settings.Tokenized.ToString()); builder.WithSetting("HiddenStringFieldSettings.TemplateString", model.Settings.TemplateString); builder.WithSetting("HiddenStringFieldSettings.AutomaticAdjustmentOnEdit", model.Settings.AutomaticAdjustmentOnEdit.ToString()); if (model.ProcessVariant != HiddenStringFieldUpdateProcessVariant.None) { // TODO: Check task isn't already scheduled. var completeFieldName = _contentTypeName + "_" + builder.PartName + "_" + builder.Name + "_" + model.ProcessVariant.ToString(); _scheduledTaskManager.CreateTask(HiddenStringFieldValueUpdateTaskHandler.UPDATEVALUES_TASK + "_" + completeFieldName, _clock.UtcNow.AddMinutes(1), null); } model.ProcessVariant = HiddenStringFieldUpdateProcessVariant.None; yield return(DefinitionTemplate(model)); } } else { yield break; } }
public override IEnumerable <TemplateViewModel> PartFieldEditor( ContentPartFieldDefinition definition) { if (definition.FieldDefinition.Name == "HiddenStringField") { var model = new HiddenStringFieldSettingsEventsViewModel { Settings = definition.Settings.GetModel <HiddenStringFieldSettings>(), ProcessVariant = HiddenStringFieldUpdateProcessVariant.None, ProcessVariants = _updateProcessor.GetVariants() }; yield return(DefinitionTemplate(model)); } else { yield break; } }