Upgrade to 3.6.6
This commit is contained in:
@@ -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
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user