That is a bit repetitive, and can be shortened to:
Kirby::plugin('cookbook/programmable-blueprints', [
'blueprints' => [
'site' => function () {
$user = kirby()->user();
// Si l'utilisateur est deconnecté
if(! $user || ! in_array($user->role()->name(), ['admin', 'editor', 'editor_stories'])) {
return Data::read(__DIR__ . '/blueprints/site.circuits.yml');
}
// Si l'utilisateur est connecté
return Data::read(__DIR__ . '/blueprints/site.' . $user->role()->name() . '.yml');
},
]
]);
(since writing without editor, I might have missed some parenthesis…)