How to fetch all options from a field of type radio

Hi all,

I have a blueprint field of type radio with a few options. I would like to fetch all available options within a template. What’s the best way to achieve that? To give some context I have a frontend form in which a logged in user can update some account settings. I want to ensure that users can only select and submit one of the defined options from the blueprint field. $user->blueprint()->field('foo') doesn’t return any options.

Thanks in advance!

What does it return? That should return an array of the field definition. The options are part of that array. Please also post what you have in the blueprint for that foo field.

Below is the blueprint and what dump($field) returns. I’m on version 4.2.0. It’s returning also a type of text which is odd but the user has no other fields then foo defined.

blueprint

foo:
  type: radio
  default: full
  columns: 2
  options:
    full: Full-Width
    centered: Centered

$field = $user->blueprint()->field(‘foo’);

Array
(
    [type] => text
    [default] => full
    [name] => foo
    [label] => Foo
    [width] => 1/1
)

That is very weird, because the field types don’t match, so seems to be a completely different field. A text field doesn’t have options. Wrong blueprint? Duplicate field names?

I agree. I’ll have to look into this when I’m back at my desk.

Alright, that’s on me. I keep my user blueprints inside a plugin but had an overwriting blueprint under site/blueprints/users.