Global User Fields

How do I defined a set of global fields within a user blueprint? Do I do it the same as a page? I have a default.yml for users which has fields defined, but when I add admin.yml the fields disappear and says “You can define additional sections and form fields for this user role in /site/blueprints/users/admin.yml” So is there a way to set reusable fields for user blueprints?

That should actually work in the same way as for pages.

Editor.yml

title: Editor

fields:

  somefield: fields/textarea

/site/blueprints/fields/textarea.yml

label: Description
type: textarea
min: 5
max: 300

So If I do it your way I get an invalid field type error.

If I go this route my sections are wrong (“No sections yet”)

admin.yml

# role
title:
  en: Admin
  de: Admin

# description
description:
  en: Admin
  de: Admin

# columns
columns:

  default:
    width: 1/1
    extends: fields/user

user.yml

# sections
sections:
  main:
    type: fields
    fields:

      # nickname
      nickname:
        type: text
        label:
          en: Nickname
          de: Nickname
        width: 1/2

      # country
      country:
        type: select
        label:
          en: Country
          de: Country
        options:
          unitedkingdom:
            en: United Kingdom
            de: United Kingdom
          germany:
            en: Germany
            de: Germany
        width: 1/2

  contact:
    type: fields
    fields:

      # twitter
      twitter:
        type: text
        label:
          en: Twitter
          de: Twitter
        icon: twitter
        width: 1/3
        placeholder:
          en: username
          de: username

      # instagram
      instagram:
        type: text
        label:
          en: Instagram
          de: Instagram
        icon: instagram
        placeholder:
          en: username
          de: username
        width: 1/3

      # snapchat
      snapchat:
        type: text
        label:
          en: Snapchat
          de: Snapchat
        icon: snapchat
        placeholder:
          en: username
          de: username
        width: 1/3

To be honest I really struggle to get my head around columns / sections / fields, haha, but I’m sure I’ll understand when I play with them all more.

Hm, I can’t get this to work, either.

Hmm, shame. Did it ever work? :stuck_out_tongue: haha. Do I need to raise this or have you raised it yourself?

I don’t know. I have to test this with pages again, haven’t come round to it yet. But in any case you could create an issue on GitHub, if it’s not a bug, then either the syntax is wrong or whatever.

For pages it works - I currently use it for an seo tab.