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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Extending account.yaml

Solved by Vadim View solution

Started by Vadim 2 years ago · 1 replies · 219 views
2 years ago

Hello everyone!

Thank you for all your hard work. I searched through the forum and didn't find an answer to my question. I would like to add couple fields to each user file by extending system/bluerints/user/account.yaml.

I tried different options, but didn't come up with the solution. I would appreciate any help on this.

Thank you!

👍 1
2 years ago Solution

Ok, the best solution comes by itself after you asked for help. In case if someone will have the same issue, here's what worked for me:

Create a new yaml file with the following path:
user/blueprints/user/account.yaml

To extend the account form you can add smth like this:

YAML
title: Account
'@extends':
    type: account
    context: 'blueprints://user'

form:
    fields:
        custom_field1:
            type: number
            label: Custom Field 1
            validate:
                type: number
        custom_field2:
            type: number
            label: Custom Field 2
            validate:
                type: number
        custom_field3:
            type: number
            label: Custom Field 3
            validate:
                type: number
👍 2

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1133 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 60 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 131 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 107 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 125 7 months ago