Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Admin markdown form field

Started by Muut Archive 10 years ago · 2 replies · 513 views
10 years ago

Hi,

I'm new to Grav, but loving it so far!

I've managed to add some custom fields to my admin interface via blueprints, which is fantastic. I do however have one question...

One of the custom fields I'm trying to add is a markdown text box. I've managed to get it to display in my custom tab, but it only takes a single paragraph. As soon as I add a line break, the validation fails.

I've scoured the docs to see what settings are available, but the markdown form field is not mentioned. In fact, I only knew it existed because I found it here:
https://github.com/getgrav/grav-plugin-admin/tree/master/themes/grav/templates/forms/fields

I've tried random settings like:

multiline: true
preview: true (I would like to enable the preview mode)

But neither of them work;(

Any help would be greatly appreciated.

10 years ago

I would also like to know the answer to this, but I found a solution anyway by looking in the file system and it looks like adding a validation in your blueprint make it works, example:

YAML
header.myblogtext:
              type: markdown
              validate:
                type: textarea

Not sure if it change something, but I have the option 'auto line break' in Configuration>System toggled to 'Yes'.
Hope it helps!

10 years ago

Thanks @paulmassendari, that validation option did the trick.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1361 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2958 9 years ago
Archive · by Muut Archive, 9 years ago
3 1123 9 years ago