Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • SinkyPars 132 posts 175 karma points
    Jun 19, 2020 @ 14:28
    SinkyPars
    0

    Macro Parameter and Form Render

    Hi,

    I'm passing in a form Id as a macro parameter.

    I'm struggling to find anywhere in V3 where I can get the ConfiguredFormInfo by Id in order to render the form.

    Any help is much appreciated.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Jun 19, 2020 @ 16:03
    Nicholas Westby
    0

    Perhaps the property value converter can serve as inspiration: https://github.com/rhythmagency/formulate/blob/3004d968b4cc67f9663f6567c0babe9a08a7d41d/src/formulate.app/Converters/ConfiguredFormConverter.cs

    Here's the relevant part of the code that uses the ID to get the ConfiguredFormInfo instance:

    // Variables.
    var id = deserialized.id.Value as string;
    var guid = string.IsNullOrWhiteSpace(id)
        ? null
        : GuidHelper.GetGuid(id) as Guid?;
    var conForm = guid.HasValue
        ? ConfiguredForms.Retrieve(guid.Value)
        : null;
    
    
    // Return configuration.
    return new ConfiguredFormInfo()
    {
        Configuration = conForm?.Path[conForm.Path.Length - 1],
        FormId = conForm?.Path[conForm.Path.Length - 2],
        LayoutId = conForm?.LayoutId,
        TemplateId = conForm?.TemplateId
    };
    

    It uses the IConfiguredFormPersistence instance to fetch details about the configured form, the creates a new instances of ConfiguredFormInfo based on those details.

Please Sign in or register to post replies

Write your reply to:

Draft