Upgrade to 3.6.6

This commit is contained in:
Bastian Allgeier
2022-05-05 13:58:33 +02:00
parent 5c64df9e2b
commit d515908e2e
12 changed files with 190 additions and 24 deletions

View File

@@ -289,13 +289,16 @@ class Blueprint
$file = $kirby->extension('blueprints', $name);
}
// callback option can be return array or blueprint file path
if (is_callable($file) === true) {
$file = $file($kirby);
}
// now ensure that we always return the data array
if (is_string($file) === true && F::exists($file) === true) {
return static::$loaded[$name] = Data::read($file);
} elseif (is_array($file) === true) {
return static::$loaded[$name] = $file;
} elseif (is_callable($file) === true) {
return static::$loaded[$name] = $file($kirby);
}
// neither a valid file nor array data

View File

@@ -97,14 +97,20 @@ class Roles extends Collection
*/
public static function load(string $root = null, array $inject = [])
{
$kirby = App::instance();
$roles = new static();
// load roles from plugins
foreach (App::instance()->extensions('blueprints') as $blueprintName => $blueprint) {
foreach ($kirby->extensions('blueprints') as $blueprintName => $blueprint) {
if (substr($blueprintName, 0, 6) !== 'users/') {
continue;
}
// callback option can be return array or blueprint file path
if (is_callable($blueprint) === true) {
$blueprint = $blueprint($kirby);
}
if (is_array($blueprint) === true) {
$role = Role::factory($blueprint, $inject);
} else {