Markdown in form label to add page link


#1

Hi,

I have a similar question to this one:
How can i add anchor link in form label?
The proposed solution was to use HTML, which seems quite ok for an absolute link or an email address, but I’d like to include a relative page link.
As my site is multi language, the easiest option I know of is a markdown relative link, which automatically adds the /cms/en/ part in front of the relative page url (i.e. /legal/privacy).

So, I need either a possibility to “inject” this site base url part including the currently active language to include in an HTML a href tag (then I could use the solution shown in the link above) or, and this I would prefer, I have the option of enabling markdown in form labels.

My file form.en.md:

title: 'Contact form'
published: true
process:
    markdown: true
child_type: default
routable: true
cache_enable: true
visible: true
form:
    name: contact
    fields:
        -
            name: name
            label: Name
            placeholder: 'Your Name'
            autofocus: 'on'
            autocomplete: 'on'
            type: text
            validate:
                required: true
        -
            name: email
            label: E-Mail
            placeholder: 'Your eMail address'
            type: email
            validate:
                required: true
        -
            name: message
            label: Message
            placeholder: 'Your message'
            type: textarea
            validate:
                required: true
        -
            name: privacyAccepted
            label: 'I consent that this personal data will be processed according to our [privacy notice](/legal/privacy).'
            type: checkbox
            style: 'float: left; margin-top: 6px;'
            validate:
                required: true
                message: 'Permission to use the given data must be granted!'
        -
            name: privacyDescription
            label: 'You may withdraw this consent at any time via eMail to [me@somewhere.com](mailto:me@somewhere.com).'
            type: display
            markdown: true
            content: null
    buttons:
        -
            type: submit
            value: Submit
        -
            type: reset
            value: Reset
    process:
        -
            email:
                subject: '[somewhere.com Contact form] {{ form.value.name|e }}'
                body: '{% include ''forms/data.html.twig'' %}'
        -
            save:
                fileprefix: contact-
                dateformat: Ymd-His-u
                extension: txt
                body: '{% include ''forms/data.txt.twig'' %}'
        -
            message: ''
        -
            display: thankyou
---

# Contact form

Please describe your concerns, I will answer as soon as possible.  
Direct contact: [me@somewhere.com](mailto:me@somewhere.com)

Thanks for your help!
Best regards,
HeliG


#2

I think this is a limiation of the current form plugin. Perhaps you can add an issue here: https://github.com/getgrav/grav-plugin-form/issues


#3

Done:


#4

and commited for next release of forms plugin.