This commit is contained in:
Bastian Allgeier
2019-01-14 10:52:45 +01:00
parent 01277f79f2
commit 8070893b64
22 changed files with 482 additions and 351 deletions

View File

@@ -119,8 +119,17 @@ return function (App $app) {
*
* @return Files
*/
'toFiles' => function (Field $field) {
return $field->parent()->files()->find(false, false, ...$field->toData('yaml'));
'toFiles' => function (Field $field, string $separator = 'yaml') {
$parent = $field->parent();
$files = new Files([]);
foreach ($field->toData($separator) as $id) {
if ($file = $parent->kirby()->file($id, $parent)) {
$files->add($file);
}
}
return $files;
},
/**
@@ -226,8 +235,8 @@ return function (App $app) {
*
* @return Users
*/
'toUsers' => function (Field $field) use ($app) {
return $app->users()->find(false, false, ...$field->toData('yaml'));
'toUsers' => function (Field $field, string $separator = 'yaml') use ($app) {
return $app->users()->find(false, false, ...$field->toData($separator));
},
// inspectors