/// <summary> /// Processes the specified context. /// </summary> /// <param name="context">The context to process.</param> public override void Process(FormBuilderContext context) { // Get the attribute FormConditionAttribute conditionAttribute = context.Property.GetCustomAttribute <FormConditionAttribute>(); // If the current property has a condition add it if (conditionAttribute != null) { string condition = FormModuleHelper.ConvertConditionToAbsolutePath(context.DtoType.Name, context.FullPropertyPath, conditionAttribute.Condition); context.GetOrCreateCurrentFormElement()["condition"] = new JValue(condition); } }
/// <summary> /// Updates a form hierarchy object. /// </summary> /// <param name="hierarchyObject">The hierarchy object.</param> /// <param name="formSection">The form section.</param> public void UpdateFormHierarchyObject(JObject hierarchyObject, FormSectionAttribute formSection, FormBuilderContext context) { hierarchyObject["type"] = ConvertSectionType(formSection.SectionType); if (!string.IsNullOrEmpty(formSection.Title)) { hierarchyObject["title"] = GetTextForKey(formSection.Title, context); } if (!string.IsNullOrEmpty(formSection.Condition)) { string condition = FormModuleHelper.ConvertConditionToAbsolutePath(context.DtoType.Name, context.FullPropertyPath, formSection.Condition); hierarchyObject["condition"] = new JValue(condition); } }