How to get a blueprint object by name?

Hi there,

in a plugin I need to access the options of a certain blueprint’s field. Something like

$myBlueprint->field('foo')['options']

This works, but now I need to get this blueprint by name first. I know there is Blueprint::find() that finds a blueprint by name, but for some reason it returns an array, not a blueprint, so I cannot use the field() method on it. Any idea how to directly find a blueprint so that I have a blueprint object to work with or alternatively how to turn the Blueprint::find() array into a blueprint object?

Thanks!

In what context?

What do you mean by context? This is happening in a hook.

I need to find the blueprint somehow by name in a way that I can still use the ->field() method on it, after I got it.

What sort of hook?

In a page.changeStatus:after hook and in a page.changeNum:after hook.

But you don’t want to get the blueprint of the page that was changed but some other blueprint?

Yes, exactly. I am just confused that one cannot get a blueprint object by name somehow.

$bp = new PageBlueprint(['name' => 'somename', 'model' => page()]);

This seems to generate a new, generic blueprint object. What am I supposed to pass in there? I give the name I am looking for under name, like

'name' => 'pages/project'

but what do I pass in under model? I am afraid I don’t understand how this finds me the blueprint named pages/project…