Listing all my blueprint´s fields in a page model

<?php

use Kirby\Cms\App as Kirby;
use Kirby\Exception\Exception;
use Kirby\Http\Remote;
use Kirby\Data\Data;
use Kirby\Toolkit\Collection;
use Kirby\Blueprint\Blueprint;

Kirby::plugin('your-name/some-plugin', [
    'pageMethods' => [
        'getBlueprintFields' => function () {
            $blueprintName = $this->content()->get('selected_blueprint')->value();
            $blueprint = how can I get the blueprint??
            $fields = $blueprint->fields();
            
            $result = "Available fields:\n";
            foreach ($fields as $name => $field) {
                $result .= "- {{$name}}\n";
            }
            return $result;
        },
    ]
]);

So basicly, I want to select a blueprint and then show all the field names in my Panel. This is in the index.php of my plugin folder. $blueprintName is working. But how to select it a get the fields?

I don´t understand it, I tried all day long.

If anyone is interessted. I think it is not possible to read the fields just from a blueprint/yml-file, you need a page!

I ended up cloning the home page, assigning the template so it uses the same-named blueprint, and then reading the fields.

$contentBlueprint = 'blueprintname';
$blueprint = kirby()->page('home')->clone([
                    'template' => $contentBlueprint
                ])->blueprint();
                
$fields = $blueprint->fields();